Skip to content

Commit 1b5c768

Browse files
Merge pull request #1310 from OneCommunityGlobal/development
Backend Release to Main [2.26]
2 parents 9cf9784 + f5d29a7 commit 1b5c768

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

src/helpers/userHelper.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const fs = require('fs');
3232
const cheerio = require('cheerio');
3333
const axios = require('axios');
3434
const sharp = require('sharp');
35+
const BlueSquareEmailAssignmentModel = require('../models/BlueSquareEmailAssignment');
3536
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3637

3738
const userHelper = function () {
@@ -913,22 +914,12 @@ const userHelper = function () {
913914
const missedSummaryTemplate = (firstname) => {
914915
return (
915916
`<div style="font-family: Arial, sans-serif;">
916-
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 0; line-height: 1;">Dear ${firstname},</p>
917-
918-
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 10px; line-height: 1;">When you read this, please input your summary into the software. When you do, please be sure to put it in using the tab for "Last Week".</p>
919-
920-
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 10px; line-height: 1;">Reply to this email once you've done this, so I know to review what you've submitted. Do this before tomorrow (Monday) at 3 PM (Pacific Time) and I'll remove this blue square.</p>
921-
922-
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 10px; line-height: 1;">With Gratitude,</p>
923-
924-
<div style="margin: 0; padding: 0; margin-top: 10px;">
925-
<p style="margin: 0; padding: 0; line-height: 1;">Jae Sabol</p>
926-
<p style="margin: 0; padding: 0; line-height: 1;">310.755.4693</p>
927-
<p style="margin: 0; padding: 0; line-height: 1;">Zoom: <a href="https://www.tinyurl.com/zoomoc">www.tinyurl.com/zoomoc</a></p>
928-
<p style="margin: 0; padding: 0; line-height: 1;">Primary Email: <a href="mailto:jae@onecommunityglobal.org">jae@onecommunityglobal.org</a></p>
929-
<p style="margin: 0; padding: 0; line-height: 1;">Google Email: <a href="mailto:onecommunityglobal@gmail.com">onecommunityglobal@gmail.com</a></p>
930-
<p style="margin: 0; padding: 0; line-height: 1;">Timezone: Los Angeles, CA - Pacific Time</p>
931-
</div>
917+
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 0; line-height: 1;">Good Morning Jae,</p>
918+
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 12px; line-height: 1;">When you read this, please input your summary into the software. When you do, please be sure to put it in using the tab for "Last Week".</p>
919+
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 10px; line-height: 1;">If you also forgot to submit your weekly media files, be sure to fix that too.</p>
920+
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 10px; line-height: 1;"><strong>Reply All</strong> to this email once you've done this, so we know to review what you've submitted. Do this before tomorrow (Monday) at 3 PM (Pacific Time) and "reply all" so we know and we will remove this blue square.</p>
921+
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 25px; line-height: 1;">With Gratitude,</p>
922+
<p style="margin: 0; padding: 0; margin-bottom: 0; margin-top: 10px; line-height: 1;">One Community</p>
932923
</div>`
933924
)
934925
}
@@ -946,6 +937,10 @@ const userHelper = function () {
946937
.subtract(1, 'week');
947938
const pdtEndOfLastWeek = moment().tz('America/Los_Angeles').endOf('week').subtract(1, 'week');
948939

940+
const bluesquarebcc=await BlueSquareEmailAssignmentModel.find().select('email');
941+
var bluesquareemails=bluesquarebcc.map((bcc)=>bcc.email);
942+
bluesquareemails.push("onecommunityglobal@gmail.com");
943+
bluesquareemails.push("jae@onecommunityglobal.org");
949944
for (let i = 0; i < users.length; i += 1) {
950945
const allowedEmails = [
951946
"jae@onecommunityglobal.org", //Summary turned off Owner
@@ -988,15 +983,14 @@ const userHelper = function () {
988983
endingDate: { $gte: utcEndMoment },
989984
});
990985
const hasTimeOffRequest = requestsForTimeOff.length > 0;
991-
992986
// log values of the below used conditions in if statement to know if the email is being sent is correct conditions
993987
if(hasTimeOffRequest===false && timeNotMet===false && hasWeeklySummary===false){
994988
emailSender(
995989
users[i].email,
996990
'Weekly Summary Missing',
997991
missedSummaryTemplate(users[i].firstName),
998992
null,
999-
'jae@onecommunityglobal.org',
993+
bluesquareemails,
1000994
'jae@onecommunityglobal.org',
1001995
);
1002996
}

0 commit comments

Comments
 (0)