Anthology CSV parse update. Backed up Supplier Prod's templates.
This commit is contained in:
@ -71,6 +71,15 @@ $(document).ready(function() {
|
|||||||
filterWrapper.classList.toggle("filter-active");
|
filterWrapper.classList.toggle("filter-active");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.addEventListener("click", function(event) {
|
||||||
|
const filterWrapper = document.querySelector('#carousel-filter-wrapper-analysis');
|
||||||
|
const isClickInside = filterWrapper.contains(event.target) || event.target.id === "filterToggleAnalysis";
|
||||||
|
|
||||||
|
if (!isClickInside) {
|
||||||
|
filterWrapper.classList.remove("filter-active");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function filterCardsAnalysis() {
|
function filterCardsAnalysis() {
|
||||||
const selectedFilters = Array.from(document.querySelectorAll('#filterContentAnalysis .filter-checkbox:checked')).map(checkbox => checkbox.id.replace('a-', ''));
|
const selectedFilters = Array.from(document.querySelectorAll('#filterContentAnalysis .filter-checkbox:checked')).map(checkbox => checkbox.id.replace('a-', ''));
|
||||||
const cards = document.querySelectorAll('.analysis-courses');
|
const cards = document.querySelectorAll('.analysis-courses');
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<div class="carousel-wrapper">
|
<div class="carousel-wrapper">
|
||||||
<div class="carousel-heading">Getting Started</div>
|
<div class="carousel-heading">Getting Started</div>
|
||||||
<div class="carousel-filter-wrapper">
|
<div class="carousel-filter-wrapper" id="carousel-filter-wrapper-started">
|
||||||
<div class="filter-container">
|
<div class="filter-container">
|
||||||
<div class="filter" id="filterToggle">Filter</div>
|
<div class="filter" id="filterToggle">Filter</div>
|
||||||
</div>
|
</div>
|
||||||
@ -69,7 +69,14 @@ $(document).ready(function() {
|
|||||||
const filterWrapper = document.querySelector('.carousel-filter-wrapper');
|
const filterWrapper = document.querySelector('.carousel-filter-wrapper');
|
||||||
filterWrapper.classList.toggle("filter-active");
|
filterWrapper.classList.toggle("filter-active");
|
||||||
});
|
});
|
||||||
|
document.addEventListener("click", function(event) {
|
||||||
|
const filterWrapper = document.querySelector('#carousel-filter-wrapper-started');
|
||||||
|
const isClickInside = filterWrapper.contains(event.target) || event.target.id === "filterToggle";
|
||||||
|
|
||||||
|
if (!isClickInside) {
|
||||||
|
filterWrapper.classList.remove("filter-active");
|
||||||
|
}
|
||||||
|
});
|
||||||
function filterCards() {
|
function filterCards() {
|
||||||
const selectedFilters = Array.from(document.querySelectorAll('.filter-checkbox:checked')).map(checkbox => checkbox.id.replace('gs-', ''));
|
const selectedFilters = Array.from(document.querySelectorAll('.filter-checkbox:checked')).map(checkbox => checkbox.id.replace('gs-', ''));
|
||||||
const cards = document.querySelectorAll('.gettin-started-courses');
|
const cards = document.querySelectorAll('.gettin-started-courses');
|
||||||
|
|||||||
@ -71,6 +71,15 @@ $(document).ready(function() {
|
|||||||
filterWrapper.classList.toggle("filter-active");
|
filterWrapper.classList.toggle("filter-active");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.addEventListener("click", function(event) {
|
||||||
|
const filterWrapper = document.querySelector('#carousel-filter-wrapper-merchandising');
|
||||||
|
const isClickInside = filterWrapper.contains(event.target) || event.target.id === "filterToggleMerchandising";
|
||||||
|
|
||||||
|
if (!isClickInside) {
|
||||||
|
filterWrapper.classList.remove("filter-active");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function filterCards1() {
|
function filterCards1() {
|
||||||
const selectedFilters = Array.from(document.querySelectorAll('#filterContentMerchandising .filter-checkbox:checked')).map(checkbox => checkbox.id.replace('m-', ''));
|
const selectedFilters = Array.from(document.querySelectorAll('#filterContentMerchandising .filter-checkbox:checked')).map(checkbox => checkbox.id.replace('m-', ''));
|
||||||
const cards = document.querySelectorAll('.merchandising-courses');
|
const cards = document.querySelectorAll('.merchandising-courses');
|
||||||
|
|||||||
@ -220,6 +220,7 @@ section {
|
|||||||
}
|
}
|
||||||
.slick-track {
|
.slick-track {
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
|
margin: 0 !important
|
||||||
}
|
}
|
||||||
.slick-slide {
|
.slick-slide {
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
|
|||||||
@ -6,9 +6,9 @@ function main() {
|
|||||||
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');
|
var date = Utilities.formatDate(getDate, 'America/New_York', 'MM/dd/yyyy hh:mm');
|
||||||
var fileDate = file.getDateCreated();
|
var fileDate = file.getDateCreated();
|
||||||
var fileDateFormatted = Utilities.formatDate(fileDate, 'America/New_York', 'MM/dd/yyyy hh');
|
var fileDateFormatted = Utilities.formatDate(fileDate, 'America/New_York', 'MM/dd/yyyy hh:mm');
|
||||||
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 +34,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' );
|
var date = Utilities.formatDate(getDate, 'America/New_York', 'MM/dd/yyyy hh:mm' );
|
||||||
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');
|
var fileDateFormatted = Utilities.formatDate(fileDate, 'America/New_York', 'MM/dd/yyyy hh:mm');
|
||||||
if (date != fileDateFormatted) {
|
if (date != fileDateFormatted) {
|
||||||
const destination = DriveApp.getFolderById('1cIPZCgoj8XdjMIfL75QfomJAxsy2smGT');
|
const destination = DriveApp.getFolderById('1cIPZCgoj8XdjMIfL75QfomJAxsy2smGT');
|
||||||
file.moveTo(destination);
|
file.moveTo(destination);
|
||||||
@ -144,12 +144,9 @@ 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("nrasmussen@gainsight.com",
|
|
||||||
// "Anthology has submitted a CSV",
|
|
||||||
// "Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList));
|
|
||||||
MailApp.sendEmail("amitd@anthology.com",
|
MailApp.sendEmail("amitd@anthology.com",
|
||||||
"Anthology has submitted a CSV",
|
"Anthology has submitted a CSV",
|
||||||
"Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList));
|
"Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList));
|
||||||
@ -165,13 +162,14 @@ function replaceOnSheet(dom, groups) {
|
|||||||
|
|
||||||
let boo = sheet.createTextFinder(dom).findNext()
|
let boo = sheet.createTextFinder(dom).findNext()
|
||||||
if (boo != null ) {
|
if (boo != null ) {
|
||||||
//Logger.log("Replace on Sheet Domain: "+dom)
|
Logger.log("Replace on Sheet Domain: "+dom)
|
||||||
//Logger.log("New groups: "+groups)
|
Logger.log("New groups: "+groups)
|
||||||
group2 = []
|
group2 = []
|
||||||
currCell = boo.getRowIndex();
|
currCell = boo.getRowIndex();
|
||||||
groups.forEach(item => { if (item.length > 0) { group2.push(item) }});
|
groups.forEach(item => { if (item.length > 0) { group2.push(item) }});
|
||||||
group2 = [group2];
|
group2 = [group2];
|
||||||
//Logger.log(group2);
|
Logger.log(group2);
|
||||||
|
sheet.getRange(currCell, 1, 1, 100).clear();
|
||||||
sheet.getRange(currCell, 1).setValue(dom);
|
sheet.getRange(currCell, 1).setValue(dom);
|
||||||
sheet.getRange(currCell, 2, 1, group2[0].length).setValues(group2)
|
sheet.getRange(currCell, 2, 1, group2[0].length).setValues(group2)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
const apiKey = '8ALsk8jDOlynEwn8ScMBSnG87';
|
const apiKey = 'ANTHOAPIKEY';
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
prepareSheet();
|
prepareSheet();
|
||||||
@ -14,14 +14,15 @@ function main() {
|
|||||||
var updated_file = file.getBlob();
|
var updated_file = file.getBlob();
|
||||||
var updated_blob = updated_file.getDataAsString();
|
var updated_blob = updated_file.getDataAsString();
|
||||||
var updated_data = Utilities.parseCsv(updated_blob, ',');
|
var updated_data = Utilities.parseCsv(updated_blob, ',');
|
||||||
|
var full_data = Utilities.parseCsv(updated_blob, ',');
|
||||||
} else if (date != fileDateFormatted) {
|
} else if (date != fileDateFormatted) {
|
||||||
var outdated_file = file.getBlob();
|
var outdated_file = file.getBlob();
|
||||||
var outdated_blob = outdated_file.getDataAsString();
|
var outdated_blob = outdated_file.getDataAsString();
|
||||||
var outdated_data = Utilities.parseCsv(outdated_blob, ',');
|
var outdated_data = Utilities.parseCsv(outdated_blob, ',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fullParse(updated_data);
|
austinComparseData(outdated_data, updated_data);
|
||||||
austinComparseData(outdated_data, updated_data)
|
fullParse(full_data);
|
||||||
moveOldFiles();
|
moveOldFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +94,7 @@ function austinComparseData(outdated_data, updated_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function quickParse(domains_to_update) {
|
function quickParse(domains_to_update) {
|
||||||
|
Logger.log("Quick Parse Item: "+domains_to_update)
|
||||||
for (var x = 1; x < domains_to_update.length; x++) {
|
for (var x = 1; x < domains_to_update.length; x++) {
|
||||||
var array = domains_to_update[x];
|
var array = domains_to_update[x];
|
||||||
for (var i = 1; i < array.length; i++) {
|
for (var i = 1; i < array.length; i++) {
|
||||||
@ -111,7 +113,7 @@ function quickParse(domains_to_update) {
|
|||||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||||
var uuidResponse = sendMsg.getContentText();
|
var uuidResponse = sendMsg.getContentText();
|
||||||
var parseData = JSON.parse(uuidResponse)
|
var parseData = JSON.parse(uuidResponse)
|
||||||
Logger.log("Austin:"+parseData)
|
Logger.log("Austin Check:"+item)
|
||||||
var groupID = parseData['data'][0]['id']
|
var groupID = parseData['data'][0]['id']
|
||||||
var groupName = array.indexOf(item);
|
var groupName = array.indexOf(item);
|
||||||
if (groupName != -1) {
|
if (groupName != -1) {
|
||||||
@ -146,7 +148,7 @@ function fullParse(updated_data) {
|
|||||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||||
var uuidResponse = sendMsg.getContentText();
|
var uuidResponse = sendMsg.getContentText();
|
||||||
var parseData = JSON.parse(uuidResponse)
|
var parseData = JSON.parse(uuidResponse)
|
||||||
Logger.log("FullParse:"+parseData)
|
Logger.log("Current Check:"+item)
|
||||||
var groupID = parseData['data'][0]['id']
|
var groupID = parseData['data'][0]['id']
|
||||||
var groupName = array.indexOf(item);
|
var groupName = array.indexOf(item);
|
||||||
if (groupName != -1) {
|
if (groupName != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user