]> git.cworth.org Git - turbot/commitdiff
Add display of state string to turbot view of each puzzle
authorCarl Worth <cworth@cworth.org>
Fri, 23 Oct 2020 00:34:01 +0000 (17:34 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 23 Oct 2020 00:34:59 +0000 (17:34 -0700)
This will be helpful in getting an overview of things.

turbot/events.py
turbot/interaction.py

index c876b15217e2e252d4683782c1a1599f0af661ef..2c1e58b21d65df96e9e64e58a56eb5e346cf587a 100644 (file)
@@ -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))
index 566a3d83caa287bbe5c6cee94d80058f69a6b808..cb6946775cc12f0ef341801f8d282aebf04e0be5 100644 (file)
@@ -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)