Anthology CSV parser updated. Courses & categories for Supplier
This commit is contained in:
@ -75,7 +75,7 @@ def get_cat_name(cat_id, course_dict, courses):
|
|||||||
course_dict.update({"categories": cats})
|
course_dict.update({"categories": cats})
|
||||||
print(course_dict)
|
print(course_dict)
|
||||||
|
|
||||||
# write_to_csv(courses)
|
write_to_csv(courses)
|
||||||
|
|
||||||
|
|
||||||
def write_to_csv(courses):
|
def write_to_csv(courses):
|
||||||
|
|||||||
@ -1,14 +1,15 @@
|
|||||||
const apiKey = '8ALsk8jDOlynEwn8ScMBSnG87';
|
const apiKey = '8ALsk8jDOlynEwn8ScMBSnG87';
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
Utilities.sleep(7500);
|
||||||
var folder = DriveApp.getFolderById("1hAz7O-eoxFUk4YW7FoHr4uNJmPs7CiV5BjBNTLtMJzXwY0CbpykYgSAkFR5Quy_MPdn3e_5j");
|
var folder = DriveApp.getFolderById("1hAz7O-eoxFUk4YW7FoHr4uNJmPs7CiV5BjBNTLtMJzXwY0CbpykYgSAkFR5Quy_MPdn3e_5j");
|
||||||
var files = folder.getFiles();
|
var files = folder.getFiles();
|
||||||
while (files.hasNext()) {
|
while (files.hasNext()) {
|
||||||
var file = files.next();
|
var file = files.next();
|
||||||
var getDate = new Date();
|
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 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) {
|
if (date == fileDateFormatted) {
|
||||||
Logger.log("Updated: "+file)
|
Logger.log("Updated: "+file)
|
||||||
var updated_file = file.getBlob()
|
var updated_file = file.getBlob()
|
||||||
@ -34,10 +35,10 @@ function moveOldFiles() {
|
|||||||
while (files.hasNext()) {
|
while (files.hasNext()) {
|
||||||
var file = files.next();
|
var file = files.next();
|
||||||
var getDate = new Date();
|
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 fileDate = file.getDateCreated();
|
||||||
Logger.log("FILE: "+file+", DATE UPLOADED: "+fileDate)
|
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) {
|
if (date != fileDateFormatted) {
|
||||||
const destination = DriveApp.getFolderById('1cIPZCgoj8XdjMIfL75QfomJAxsy2smGT');
|
const destination = DriveApp.getFolderById('1cIPZCgoj8XdjMIfL75QfomJAxsy2smGT');
|
||||||
file.moveTo(destination);
|
file.moveTo(destination);
|
||||||
@ -144,7 +145,7 @@ function updatedDomainsOnly(domains_to_update) {
|
|||||||
const dom = array.shift();
|
const dom = array.shift();
|
||||||
const groups = array;
|
const groups = array;
|
||||||
Logger.log("{domain_to_update : {domain :"+dom+", group_ids : "+groups+" }}")
|
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);
|
replaceOnSheet(dom, groups);
|
||||||
}
|
}
|
||||||
MailApp.sendEmail("amitd@anthology.com",
|
MailApp.sendEmail("amitd@anthology.com",
|
||||||
|
|||||||
Reference in New Issue
Block a user