X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Fpuzzle.py;h=08e86218738bbfba6cdeff598ded4acdfb758cec;hb=5e7ee7c20f71996cedd04586d7139250c6704c0d;hp=1dbea5d74906c447b3e6b09df70758f4379389d5;hpb=0878d40471403513b6da016d7412d07a5d903e9b;p=turbot diff --git a/turbot/puzzle.py b/turbot/puzzle.py index 1dbea5d..08e8621 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.get('type', 'plain') == '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']) ) @@ -290,7 +300,7 @@ def puzzle_update_channel_and_sheet(turb, puzzle, old_puzzle=None): old_sheet_name = puzzle_sheet_name(old_puzzle) if sheet_name != old_sheet_name: - turbot.sheets.renameSheet(turb, puzzle['sheet_url'], sheet_name) + turbot.sheets.rename_spreadsheet(turb, puzzle['sheet_url'], sheet_name) # Compute the Slack channel name and set it if it has changed channel_name = puzzle_channel_name(puzzle)