From: Carl Worth Date: Sat, 8 Jan 2022 01:26:59 +0000 (-0800) Subject: Fix puzzle edit form in the case of no existing rounds in the hunt yet X-Git-Url: https://git.cworth.org/git?p=turbot;a=commitdiff_plain;h=42dde0b52a225b0cad1366b106a5fd14f679861b 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). --- 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: