From c09a05591d2224c23dab510a94d4a0fc787aadc8 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 9 Jan 2021 07:52:41 -0800 Subject: [PATCH] Add both round and "-m" (for META), if appropriate, into channel name For better grouping of related puzzles in the channel list --- turbot/puzzle.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/turbot/puzzle.py b/turbot/puzzle.py index f2816ac..e1e1bc2 100644 --- a/turbot/puzzle.py +++ b/turbot/puzzle.py @@ -242,11 +242,21 @@ def puzzle_channel_topic(puzzle): def puzzle_channel_name(puzzle): """Compute the channel name for a puzzle""" + round = '' + if 'rounds' in puzzle: + round = '-' + puzzle_id_from_name(puzzle['rounds'][0]) + + meta = '' + if puzzle['type'] == 'meta': + meta = '-m' + # Note: We don't use puzzle['puzzle_id'] here because we're keeping # that as a persistent identifier in the database. Instead we # create a new ID-like identifier from the current name. - channel_name = "{}-{}".format( + channel_name = "{}{}{}-{}".format( puzzle['hunt_id'], + round, + meta, puzzle_id_from_name(puzzle['name']) ) -- 2.43.0