X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Finteraction.py;h=8bff8bc3cbc656571ca0a953a5002d9f7659ec3d;hb=29c36d3057c5602c5a4b6fb0e48f454db01ddd9d;hp=9e92242c0f64208b3a09a22772968f8ce045dbfd;hpb=32698832814a2c60498a1fc1f8ed1d28b69dd41a;p=turbot diff --git a/turbot/interaction.py b/turbot/interaction.py index 9e92242..8bff8bc 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -2,7 +2,11 @@ from slack.errors import SlackApiError from turbot.blocks import ( input_block, section_block, text_block, multi_select_block, checkbox_block ) -from turbot.hunt import find_hunt_for_hunt_id, hunt_blocks +from turbot.hunt import ( + find_hunt_for_hunt_id, + hunt_blocks, + hunt_puzzles_for_hunt_id +) from turbot.puzzle import ( find_puzzle_for_url, find_puzzle_for_sort_key, @@ -11,6 +15,7 @@ from turbot.puzzle import ( puzzle_blocks, puzzle_sort_key ) +from turbot.round import round_quoted_puzzles_titles_answers import turbot.rot import turbot.sheets import turbot.slack @@ -664,6 +669,24 @@ def puzzle(turb, body, args): blocks = puzzle_blocks(puzzle, include_rounds=True) + # For a meta puzzle, also display the titles and solutions for all + # puzzles in the same round. + if puzzle['type'] == 'meta': + puzzles = hunt_puzzles_for_hunt_id(turb, puzzle['hunt_id']) + + # Drop this puzzle itself from the report + puzzles = [p for p in puzzles if p['puzzle_id'] != puzzle['puzzle_id']] + + for round in puzzle.get('rounds', [None]): + answers = round_quoted_puzzles_titles_answers(round, puzzles) + blocks += [ + section_block(text_block( + "*Feeder solutions from round {}*".format( + round if round else "" + ))), + section_block(text_block(answers)) + ] + requests.post(response_url, json = {'blocks': blocks}, headers = {'Content-type': 'application/json'}