From: Carl Worth Date: Sat, 9 Jan 2021 10:47:57 +0000 (-0800) Subject: new_puzzle_submission: Create a puzzle dict before shoving it into the DB X-Git-Url: https://git.cworth.org/git?p=turbot;a=commitdiff_plain;h=5a1bf7d220db5d91db52dce48bdf29485eae105b new_puzzle_submission: Create a puzzle dict before shoving it into the DB This will be handy for calling some puzzle.py functions that expect a dict. --- diff --git a/turbot/interaction.py b/turbot/interaction.py index b220161..c0aff61 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -776,8 +776,8 @@ def new_puzzle_submission(turb, payload, metadata): } ) - # Insert the newly-created puzzle into the database - item={ + # Construct a puzzle dict + puzzle = { "hunt_id": hunt_id, "SK": "puzzle-{}".format(puzzle_id), "puzzle_id": puzzle_id, @@ -788,10 +788,12 @@ def new_puzzle_submission(turb, payload, metadata): "type": puzzle_type } if url: - item['url'] = url + puzzle['url'] = url if rounds: - item['rounds'] = rounds - turb.table.put_item(Item=item) + puzzle['rounds'] = rounds + + # Insert the newly-created puzzle into the database + turb.table.put_item(Item=puzzle) return lambda_ok