Google Scripts for Talkspace & Doximity. SOme walmart notes

This commit is contained in:
Norm Rasmussen
2023-06-07 15:22:27 -04:00
parent e924fdb040
commit f4faed7dc1
11 changed files with 81 additions and 26 deletions

Binary file not shown.

View File

@ -17,6 +17,7 @@
<div class="np-card-content-subtitle">
{{ course.instructor_names }}
</div>
{% include "course_details"%}
<div class="np-card-content-footer">
<div class="np-card-content-progress np-button-color">
{% t shared.progress, count: course.progress %}
@ -38,4 +39,4 @@
border-radius: 4px;
box-shadow: 0 1px 3px 0 rgb(89 105 123 / 50%);
}
</style>
</style>

View File

@ -38,4 +38,5 @@
<option class="second-login-group-option" value="2a0100e6-2cd3-4f14-9706-ddadb95e9cb3">Tim Lavin Accounts</option>
<option class="second-login-group-option" value="58309856-2659-465b-83bc-9462be60c125">Tyler Schaaf Accounts</option>
<option class="second-login-group-option" value="da7a064a-da24-4011-b7ba-ffa33586d36c">Mizuno Canada</option>
<option class="second-login-group-option" value"1ee46f9a-8a38-4c18-ac27-4578e8cc5dbf">Chris Nugent Accounts</option>
</select>

View File

@ -38,4 +38,5 @@
<option class="second-login-group-option" value="2a0100e6-2cd3-4f14-9706-ddadb95e9cb3">Tim Lavin Accounts</option>
<option class="second-login-group-option" value="58309856-2659-465b-83bc-9462be60c125">Tyler Schaaf Accounts</option>
<option class="second-login-group-option" value="da7a064a-da24-4011-b7ba-ffa33586d36c">Mizuno Canada</option>
<option class="second-login-group-option" value"1ee46f9a-8a38-4c18-ac27-4578e8cc5dbf">Chris Nugent Accounts</option>
</select>

View File

@ -494,3 +494,10 @@ Charlie couldn't replicate. Franklin didn't notice it happening on all videos.
TODO: Ask Cam for an update on all the cover images and gifs in a single zip file. Whatever he has named the file is
okay.
## 06/07/2023
### Reviewing Aditi's Resource Bundle & SCORM items
* Next month's will go out on the 30th.
TODO: Work with Cassie before the 30th to get SCORM versions decoupled.

View File

@ -1,9 +1,9 @@
/*
This script sends a daily reminder to the Sales and Marketing channel as to which
lines of data are unclean and not filled out. Currently, it is only pulling from the last 5 days.
This will be sent out between 3-4pm so that AEs can get their data in and clean before EOD.
/*
This script sends a daily reminder to the Sales and Marketing channel as to which
lines of data are unclean and not filled out. Currently, it is only pulling from the last 5 days.
This will be sent out between 3-4pm so that AEs can get their data in and clean before EOD.
Any questions or changes needed, see Norm.
Webhook URL in this sheet is for #sales-n-marketing channel.
Webhook URL in this sheet is for #sales-n-marketing channel.
*/
// Setup of the sheet
const sheet = SpreadsheetApp.getActiveSheet();
@ -22,11 +22,11 @@ var meetingCount = 0;
var finalAEList;
var tagUsers;
/*
/*
This function will create two empty arrays, one for the list of missed entries and one for tagging users in Slack
First, the function gets the data ranges in spreadsheed and adds those columns to an array index.
Second, the for loop cycles through the super long array (4 results per line). Based on the if statement,
the loop removes all arrays that don't fit the statement.
the loop removes all arrays that don't fit the statement.
*/
function findMeetings() { // Setting up data range and empty arrays
var startRow = 2; // First row of data to process
@ -43,12 +43,12 @@ function findMeetings() { // Setting up data range and empty arrays
var date = Utilities.formatDate(row[3],'America/New_York','MM/dd/yyyy'); // Column - D
var company = row[4]; // Column - E
let missedEntries = [name, date, company, attended];
/*
Adding a For Loop will pull a result for EACH element, aka 4 results per line.
/*
Adding a For Loop will pull a result for EACH element, aka 4 results per line.
This pulls one for each group of missedEntries
This then removes the last value (attended, since we already know it is a blank), converts to a string,
and adds to a new array. The counter will compare if there is more than one entry in the array.
*/
and adds to a new array. The counter will compare if there is more than one entry in the array.
*/
if ((missedEntries[3] == "") && (missedEntries[1] >= formatWeek) && (missedEntries[1] <= formatNow)) {
meetingCount += 1;
missedEntries.pop();
@ -57,10 +57,10 @@ function findMeetings() { // Setting up data range and empty arrays
//Logger.log(slackingAEListOne);
};
};
/* Now outside of the if statement:
/* Now outside of the if statement:
the array is built, and we want each group to be on a new line, remove the commas and add a hyphen.
The counter counts if there is 1 or more meetings, or not. If 0, it sends a certain message, not tagging anyone.
If it is one or more, it splices by the first array (index 0), adds a new line, and replaces commans with hyphens.
If it is one or more, it splices by the first array (index 0), adds a new line, and replaces commans with hyphens.
*/
if (meetingCount >= 1) {
var slackingAEListTwo = slackingAEListOne.splice(0).join('\n');
@ -95,8 +95,8 @@ function findMeetings() { // Setting up data range and empty arrays
tagList.push('<@U0325CWA3N3>');
}
var tagUsers = tagList.toString();
/*
Now, we're building the payload for the Slack Message.
/*
Now, we're building the payload for the Slack Message.
This is very specific and prone to errors, so check that it works using Slack's tool:
https://app.slack.com/block-kit-builder/
@ -169,7 +169,7 @@ function findMeetings() { // Setting up data range and empty arrays
// This is standard operating procedure to creating the payload and destination
const webhook = "https://hooks.slack.com/services/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";
const options = {
method: "post",
method: "post",
contentType: "application/json",
muteHttpExceptions: true,
payload: JSON.stringify(payloadText),
@ -179,10 +179,10 @@ function findMeetings() { // Setting up data range and empty arrays
//Logger.log(sendMsg); // Debug to confirm send
//Logger.log(respCode); // Debug to show errors, if any
/*
This is the else statement that sends a certain message not tagging anyone and saying that data is clean.
This is the else statement that sends a certain message not tagging anyone and saying that data is clean.
*/
} else {
let noMeetingMsg =
let noMeetingMsg =
{
"blocks": [
{
@ -204,7 +204,7 @@ function findMeetings() { // Setting up data range and empty arrays
// This is standard operating procedure to creating the payload and destination
const webhook = "https://hooks.slack.com/services/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";
const options = {
method: "post",
method: "post",
contentType: "application/json",
muteHttpExceptions: true,
payload: JSON.stringify(noMeetingMsg),

View File

@ -0,0 +1 @@
{"scriptId":"13jMb_qCijEsEwZMcsx28oYQrKEKm-HlE0yKkz7xLOWmcykwK9YZz_nDG","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/Doximity"}

View File

@ -0,0 +1,7 @@
{
"timeZone": "America/New_York",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}

View File

@ -0,0 +1,15 @@
function addVlookFormula() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
Utilities.sleep(10000)
var value = sheet.getRange(2,2).getValue();
if (value != "Is People Manager?") {
sheet.insertColumnAfter(1);
sheet.getRange(2,2).setValue("Is People Manager?");
lastRow = sheet.getLastRow();
for(var i=3; i<lastRow;i++){
sheet.getRange(i,2).setFormula('=VLOOKUP(A'+i+', Assignments!$B:$C, 2, false)');
};
}
}

View File

@ -15,32 +15,40 @@ function checkBamboo() {
var parseProps = JSON.parse(txtResponse);
var switched_on = parseProps["data"]["attributes"]["switched_on"];
var configured = parseProps["data"]["attributes"]["configured"];
console.log(switched_on)
console.log(configured)
var now = new Date();
var datetime = Utilities.formatDate(now, 'America/New_York', 'MM/dd/yyyy - HH:mm'); // Today
// var emailQuotaRemaining = MailApp.getRemainingDailyQuota();
// console.log(emailQuotaRemaining)
// This is just for testing purposes tp make sure the emails work. This setup did.
// MailApp.sendEmail("nrasmussen@northpass.com",
// MailApp.sendEmail("nrasmussen@northpass.com",
// "cbencivenga@northpass.com",
// "BambooHR Is Down",
// "Your Bamboo HR Integration is currently turned off."
// );
if (switched_on == "true" && configured == "true") {
if (switched_on == "false" && configured == "false") {
MailApp.sendEmail("nrasmussen@northpass.com",
"BambooHR Is Down",
"Your Bamboo HR Integration is currently turned off."
);
}
if (switched_on == "false" && configured == "false") {
MailApp.sendEmail("jenna.cherry@talkspace.com",
"BambooHR Is Down",
"Your Bamboo HR Integration is currently turned off."
);
}
// var sheet = SpreadsheetApp.openById('1dJJ4no9j4sJ8fKvhxh6mGiailv4YyI0EsqvjJPYVtIM');
var ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1dJJ4no9j4sJ8fKvhxh6mGiailv4YyI0EsqvjJPYVtIM/');
var sheet = ss.getActiveSheet();
var lastRow = sheet.getLastRow()+1;
console.log(lastRow)
//sheet.getRange(lastRow, 1).setValue(datetime);
sheet.getRange(lastRow, 1).setValue(datetime);
sheet.getRange(lastRow, 2).setValue(switched_on);
sheet.getRange(lastRow, 3).setValue(configured);
}

View File

@ -26,6 +26,7 @@ function getAssignment() {
var sheet = SpreadsheetApp.getActiveSheet();
var api_url =
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
Logger.log(api_url)
const settings = {
async: true,
crossDomain: true,
@ -62,9 +63,22 @@ function getAssignment() {
var full_name = info["attributes"]["full_name"];
var email = info["attributes"]["email"];
let rowArray = [submit_date, download_link, person, full_name, email];
Logger.log(rowArray);
addToSheet(rowArray);
};
} else {
}
page++;
getAssignment(page);
};
function addToSheet(rowArray){
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = Math.max(sheet.getLastRow(),1);
sheet.insertRowAfter(lastRow);
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
}