-from turbot.puzzle import puzzle_block
+from turbot.puzzle import puzzle_blocks
from turbot.blocks import section_block, text_block
-def round_blocks(round, puzzles):
+def round_blocks(round, puzzles, omit_header=False):
"""Generate Slack blocks for a round
The 'round' argument should be the name of a round as it appears
channels and sheets, etc.).
"""
- round_text = "*Round: {}*".format(round)
+ if omit_header:
+ blocks = []
+ else:
+ round_text = "*Round: {}*".format(round)
- blocks = [
- section_block(text_block(round_text)),
- ]
+ blocks = [
+ section_block(text_block(round_text)),
+ ]
for puzzle in puzzles:
if 'rounds' not in puzzle:
continue
if round not in puzzle['rounds']:
continue
- blocks.append(puzzle_block(puzzle))
+ blocks += puzzle_blocks(puzzle)
return blocks