From: Carl Worth Date: Fri, 23 Oct 2020 00:34:01 +0000 (-0700) Subject: Add display of state string to turbot view of each puzzle X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=65335f556ce754fa5bef24333fb9dcf42c766e93;p=turbot Add display of state string to turbot view of each puzzle This will be helpful in getting an overview of things. --- diff --git a/turbot/events.py b/turbot/events.py index c876b15..2c1e58b 100644 --- a/turbot/events.py +++ b/turbot/events.py @@ -21,6 +21,7 @@ def puzzle_block(puzzle): channel_id = puzzle['channel_id'] url = puzzle.get('url', None) sheet_url = puzzle.get('sheet_url', None) + state = puzzle.get('state', None) status_emoji = '' solution_str = '' @@ -38,10 +39,14 @@ def puzzle_block(puzzle): if sheet_url: links.append("<{}|Sheet>".format(sheet_url)) - puzzle_text = "{}{} <{}|{}> ({})".format( + state_str = '' + if state: + state_str = "\n{}".format(state) + + puzzle_text = "{}{} <{}|{}> ({}){}".format( status_emoji, solution_str, channel_url(channel_id), name, - ', '.join(links) + ', '.join(links), state_str ) return section_block(text_block(puzzle_text)) diff --git a/turbot/interaction.py b/turbot/interaction.py index 566a3d8..cb69467 100644 --- a/turbot/interaction.py +++ b/turbot/interaction.py @@ -334,8 +334,8 @@ def puzzle_submission(turb, payload, metadata): # Validate that the puzzle_id contains no invalid characters if not re.match(valid_id_re, puzzle_id): return submission_error("puzzle_id", - "Puzzle ID can only contain lowercase letters, " - + "numbers, and underscores") + "Puzzle ID can only contain lowercase letters," + + " numbers, and underscores") # Create a channel for the puzzle hunt_dash_channel = "{}-{}".format(hunt_id, puzzle_id)