]> git.cworth.org Git - turbot/blobdiff - turbot/interaction.py
Fix puzzle edit form in the case of no existing rounds in the hunt yet
[turbot] / turbot / interaction.py
index 6a94a342b88004ef4a384027d61f437f2089aa48..cbb8befe2bcb3eb4ebf3df0d7f3165fcf1f5e128 100644 (file)
@@ -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: