]> git.cworth.org Git - turbot/blobdiff - turbot/events.py
Create puzzle sheets in the hunt folder
[turbot] / turbot / events.py
index 8f9f12c4d4d130c45ed57f9dafa19b258587cf82..adf7c9e04853f0a3561bf96749af14e05b4157ee 100644 (file)
@@ -191,6 +191,10 @@ def puzzle_channel_created(turb, channel_name, channel_id):
               .format(channel_id, puzzle['sheet_url']))
         return lambda_success
 
+    # We need hunt from the database to know which folder to create
+    # the sheet in.
+    hunt = find_hunt_for_hunt_id(turb, puzzle['hunt_id'])
+
     # Before launching into sheet creation, indicate that we're doing this
     # in the database. This way, if we take too long to create the sheet
     # and Slack retries the event, that next event will see this 'pending'
@@ -200,7 +204,7 @@ def puzzle_channel_created(turb, channel_name, channel_id):
     turb.table.put_item(Item=puzzle)
 
     # Create a sheet for the puzzle
-    sheet = sheets_create_for_puzzle(turb, puzzle)
+    sheet = sheets_create_for_puzzle(turb, puzzle, hunt['folder_id'])
 
     # Update the database with the URL of the sheet
     puzzle['sheet_url'] = sheet['url']