From 42dde0b52a225b0cad1366b106a5fd14f679861b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 7 Jan 2022 17:26:59 -0800 Subject: [PATCH] Fix puzzle edit form in the case of no existing rounds in the hunt yet This was a corner case affecting only the first few puzzles or so, (before any puzzles were associated with a round). --- turbot/interaction.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/turbot/interaction.py b/turbot/interaction.py index 6a94a34..cbb8bef 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -267,10 +267,11 @@ def edit_puzzle_submission(turb, payload, metadata): puzzle['type'] = 'meta' else: puzzle['type'] = 'plain' - rounds = [option['value'] for option in - state['rounds']['rounds']['selected_options']] - if rounds: - puzzle['rounds'] = rounds + if 'rounds' in state: + rounds = [option['value'] for option in + state['rounds']['rounds']['selected_options']] + if rounds: + puzzle['rounds'] = rounds new_rounds = state['new_rounds']['new_rounds']['value'] puzzle_state = state['state']['state']['value'] if puzzle_state: -- 2.43.0