]> git.cworth.org Git - turbot/commitdiff
Put the puzzle's name into the first tab of the sheet
authorCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2021 16:06:31 +0000 (08:06 -0800)
committerCarl Worth <cworth@cworth.org>
Sat, 9 Jan 2021 16:06:31 +0000 (08:06 -0800)
Just to make it that much easier to tell apart multiple sheet windows
that a user might have to juggle.

TODO
turbot/sheets.py

diff --git a/TODO b/TODO
index 72bb4b3b2dbd32dbfb2ab1216f1c56921c6916aa..c0f82e9173354de554b5345b2a7d09551a58a91c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -78,8 +78,6 @@ Sheet-related fixes
   have backup access to all of them on the off chance of Slack not
   being available.)
 
-• Put the puzzle's name into the primary tab of the sheet
-
 • Do something to make it more clear which tabs exist just as
   backup/reference from the original template vs. any new tab a user
   has created during the hunt. (Perhaps color the reference tabs
index 37bd363ac8a85270d90df6d16b4415b47dd72bf2..df2e4e9b10828068048f752b1b57bf3ed9912c63 100644 (file)
@@ -66,9 +66,12 @@ def sheets_create_for_puzzle(turb, puzzle):
                 body={
                     "destinationSpreadsheetId": spreadsheet_id
                 }).execute()
-            # Rename each copied sheet to match original name
-            rename_sheet(turb, spreadsheet_id, res['sheetId'],
-                         sheet["properties"]["title"])
+            # Rename each copied sheet to match the name from the template
+            sheet_name = sheet["properties"]["title"]
+            # Except for "Text" which we rename to the puzzle name
+            if sheet_name == "Text":
+                sheet_name = puzzle['name']
+            rename_sheet(turb, spreadsheet_id, res['sheetId'], sheet_name)
 
     # Next, delete the blank sheet that's was created before the template
     sheet_id = spreadsheet['sheets'][0]['properties']['sheetId']