From 5c08acdb46521ef042d0b2bc94d54a3d94e0ec7f Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Fri, 9 Feb 2024 16:50:16 -0500 Subject: [PATCH] Took a Flask function to download templates since product is changing some of our theming and templates. Anthology CSV script was updated. --- Custom_Templates/customer_templates/.DS_Store | Bin 30724 -> 30724 bytes .../dashboard.html.liquid | 4 +- CustomerNotes/Anthology/Anthology.md | 13 +++- Scripts/API_Tests/template_download.py | 65 ++++++++++++++++++ .../MasterCSV_Parser.js | 2 +- 5 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 Scripts/API_Tests/template_download.py diff --git a/Custom_Templates/customer_templates/.DS_Store b/Custom_Templates/customer_templates/.DS_Store index dd2a9170a85d20cffd3b070a2f2dbb1cff886c08..0e3bd1a931e739c0f643e23845c5e6c4dd0c98a6 100644 GIT binary patch delta 195 zcmZqqz}WJEae_bNp^X6wOq1WJ@UhvhU|?Wio6HlSF!_qV$mBgta*QsMZ!?)qUYuY& zS%mq>W{z@Jn;Yk delta 189 zcmZqqz}WJEae_bN!Hoe5Oq1nQc{nOIxLN2eI_fyNfk|z$UV!N2-AvMx)e=M}zh+Wm zESbE)MSOB-;+@Sx984^W**SDJ+nY?|o-A)KHCf$(e{unn;NiH)-2gpud z!X(1sV`>97abltLWbOdP%?Sa0{FC=HY4WbmUw+gPNtV%L@*XCM%>fA(Jew!P#4%%2 QB)*xw;2q0m#Z-P~0BlA=Q2+n{ diff --git a/Custom_Templates/customer_templates/Anthology Academy - Prod/dashboard.html.liquid b/Custom_Templates/customer_templates/Anthology Academy - Prod/dashboard.html.liquid index b60be675..04ac6a0d 100644 --- a/Custom_Templates/customer_templates/Anthology Academy - Prod/dashboard.html.liquid +++ b/Custom_Templates/customer_templates/Anthology Academy - Prod/dashboard.html.liquid @@ -44,7 +44,7 @@ {% include "filter_by_product", page: 'Dashboard' %} - +
Your Resources @@ -268,4 +268,4 @@ margin-bottom: 0 !important; } -{% endif %} {%- endcomment -%} \ No newline at end of file +{% endif %} {%- endcomment -%} diff --git a/CustomerNotes/Anthology/Anthology.md b/CustomerNotes/Anthology/Anthology.md index 18c99ab2..719eb1f0 100644 --- a/CustomerNotes/Anthology/Anthology.md +++ b/CustomerNotes/Anthology/Anthology.md @@ -374,6 +374,17 @@ Maybe Anthology101? Unsure if the bars were submitted. ## 01/12/2023 -### Manager Permissions, CSV Mapping, etc. +### Manager Permissions, CSV Mapping, etc TODO: Create a course called "Manager Content - Student" with all the media library files that have STU. + +## 02/09/2023 + +### Katie and KC + +Recently overhauled all their CSM, CXM, AE, CEM jobs that were all doing different jobs should all be doing the "same" job. +Mission structure has changed as well. + +KC wants to be able to filter groups in analytics. We will need to create "account" groups. + +TODO: Test Finance & HCM in the CSV flow. diff --git a/Scripts/API_Tests/template_download.py b/Scripts/API_Tests/template_download.py new file mode 100644 index 00000000..b395dd84 --- /dev/null +++ b/Scripts/API_Tests/template_download.py @@ -0,0 +1,65 @@ +import Apikeys +import inspect +import os +import requests +from datetime import datetime + +TEMPLATES_DIR = ( + "/Users/normrasmussen/Documents/Work/Custom_Templates/Template-backup-tmp/" +) +URL = "https://api.northpass.com/" + + +def test(): + print(name) + + +def template_endpoint(): + for customer, apikey in inspect.getmembers(Apikeys): + global customer_path = os.path.join(TEMPLATES_DIR, customer) + os.mkdir(customer_path) + + count = 0 + templates = [] + + while True: + count += 1 + endpoint = f"v2/custom_templates?page={count}" + headers = { + "accept": "application/json", + "content-type": "application/json", + "X-Api-Key": apikey, + } + response = requests.get(URL + endpoint, headers=headers) + data = response.json() + for response in data["data"]: + last_updated = response["attributes"]["updated_at"].split("T") + # full_updated = response["attributes"]["updated_at"] + # full_updated = datetime.fromisoformat(full_updated) + last_updated = last_updated[0] + name, body, last_updated = ( + response["attributes"]["name"], + response["attributes"]["body"], + last_updated, + ) + templates.append((name, body, last_updated)) + + if data["data"] == []: + break + + save_templates(templates) + + +def save_templates(templates): + for tupe in templates: + file_name = tupe[0] + ".liquid" + file_body = tupe[1] + final_path = os.path.join(customer_path, file_name) + + with open(final_path, "w+") as temp: + temp.write(file_body) + temp.close + + +if __name__ == "__main__": + template_endpoint() diff --git a/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js b/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js index 14c51c10..70936d6f 100644 --- a/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js +++ b/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js @@ -33,7 +33,7 @@ function main(previousLast) { } } austinComparseData(outdated_data, updated_data); - //moveOldFiles(); + moveOldFiles(); } function moveOldFiles() {