]> git.cworth.org Git - turbot/blobdiff - turbot/interaction.py
Farm blocks-creation code out to various supporting files
[turbot] / turbot / interaction.py
index d8a252b316d13363d45950adf8b8ad2169f1ba17..359823464f40e5e31de28aa07abc2738bed1ca68 100644 (file)
@@ -466,6 +466,11 @@ def puzzle_submission(turb, payload, metadata):
     # Add any new rounds to the database
     if new_rounds:
         for round in new_rounds.split(','):
+            # Drop any leading/trailing spaces from the round name
+            round = round.strip()
+            # Ignore any empty string
+            if not len(round):
+                continue
             rounds.append(round)
             turb.table.put_item(
                 Item={
@@ -571,7 +576,8 @@ def solved(turb, body, args):
     # Set the status and solution fields in the database
     puzzle['status'] = 'solved'
     puzzle['solution'].append(args)
-    del puzzle['state']
+    if 'state' in puzzle:
+        del puzzle['state']
     turb.table.put_item(Item=puzzle)
 
     # Report the solution to the puzzle's channel