From 4a3ad336a54a0fec7afa33e67670aaac3e077dbd Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Mon, 19 May 2025 14:26:29 -0400 Subject: [PATCH] Anthology CSV parser updated. Courses & categories for Supplier --- Scripts/API_Tests/get_courses_and_categories.py | 2 +- .../AnthologyCSV-Parse-Prod/MasterCSV_Parser.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Scripts/API_Tests/get_courses_and_categories.py b/Scripts/API_Tests/get_courses_and_categories.py index 8dbe5df4..cad35343 100644 --- a/Scripts/API_Tests/get_courses_and_categories.py +++ b/Scripts/API_Tests/get_courses_and_categories.py @@ -75,7 +75,7 @@ def get_cat_name(cat_id, course_dict, courses): course_dict.update({"categories": cats}) print(course_dict) - # write_to_csv(courses) + write_to_csv(courses) def write_to_csv(courses): diff --git a/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js b/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js index 7d185b69..51979c8c 100755 --- a/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js +++ b/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js @@ -1,14 +1,15 @@ const apiKey = '8ALsk8jDOlynEwn8ScMBSnG87'; function main() { + Utilities.sleep(7500); var folder = DriveApp.getFolderById("1hAz7O-eoxFUk4YW7FoHr4uNJmPs7CiV5BjBNTLtMJzXwY0CbpykYgSAkFR5Quy_MPdn3e_5j"); var files = folder.getFiles(); while (files.hasNext()) { var file = files.next(); var getDate = new Date(); - var date = Utilities.formatDate(getDate, 'America/New_York', 'MM/dd/yyyy hh:mm'); + var date = Utilities.formatDate(getDate, 'America/New_York', 'MM/dd/yyyy hh'); var fileDate = file.getDateCreated(); - var fileDateFormatted = Utilities.formatDate(fileDate, 'America/New_York', 'MM/dd/yyyy hh:mm'); + var fileDateFormatted = Utilities.formatDate(fileDate, 'America/New_York', 'MM/dd/yyyy hh'); if (date == fileDateFormatted) { Logger.log("Updated: "+file) var updated_file = file.getBlob() @@ -34,10 +35,10 @@ function moveOldFiles() { while (files.hasNext()) { var file = files.next(); var getDate = new Date(); - var date = Utilities.formatDate(getDate, 'America/New_York', 'MM/dd/yyyy hh:mm' ); + var date = Utilities.formatDate(getDate, 'America/New_York', 'MM/dd/yyyy hh' ); var fileDate = file.getDateCreated(); Logger.log("FILE: "+file+", DATE UPLOADED: "+fileDate) - var fileDateFormatted = Utilities.formatDate(fileDate, 'America/New_York', 'MM/dd/yyyy hh:mm'); + var fileDateFormatted = Utilities.formatDate(fileDate, 'America/New_York', 'MM/dd/yyyy hh'); if (date != fileDateFormatted) { const destination = DriveApp.getFolderById('1cIPZCgoj8XdjMIfL75QfomJAxsy2smGT'); file.moveTo(destination); @@ -144,7 +145,7 @@ function updatedDomainsOnly(domains_to_update) { const dom = array.shift(); const groups = array; Logger.log("{domain_to_update : {domain :"+dom+", group_ids : "+groups+" }}") - //sendWebhook({domain_to_update : { domain: dom, group_ids: groups }}) + sendWebhook({domain_to_update : { domain: dom, group_ids: groups }}) replaceOnSheet(dom, groups); } MailApp.sendEmail("amitd@anthology.com",