Skip to content

Commit

Permalink
Merge pull request #186 from ITPNYU/feature/add_safety_training_sheets
Browse files Browse the repository at this point in the history
Add old safety training sheet
  • Loading branch information
rlho authored Apr 16, 2024
2 parents 5c8df94 + 69e5c5a commit 7d1f2f1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions media_commons_booking_app/src/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export const OLD_SAFETY_TRAINING_SHEET_ID =
'1Debe5qF-2qXJhqP0AMy5etEvwAPd3mNFiTswytsbKxQ';
/** Old safety training sheet within OLD_SAFETY_TRAINING_SHEET_ID */
export const OLD_SAFETY_TRAINING_SHEET_NAME = 'Sheet1';
export const SECOND_OLD_SAFETY_TRAINING_SHEET_ID =
'1TZYBrX5X6TXM07V3OMTOnVWF8qRmWnTzh27zacrQHh0';
export const SECOND_OLD_SAFETY_TRAINING_SHEET_GID = 293202487;

/********** CONTACTS ************/

Expand Down
17 changes: 16 additions & 1 deletion media_commons_booking_app/src/server/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {
ACTIVE_SHEET_ID,
OLD_SAFETY_TRAINING_SHEET_ID,
OLD_SAFETY_TRAINING_SHEET_NAME,
SECOND_OLD_SAFETY_TRAINING_SHEET_ID,
SECOND_OLD_SAFETY_TRAINING_SHEET_GID,
TableNames,
} from '../policy';

Expand Down Expand Up @@ -138,5 +140,18 @@ export const getOldSafetyTrainingEmails = () => {
var range = activeSheet.getRange(1, 5, lastRow);
var values = range.getValues();

return values;
const secondSpreadSheet = SpreadsheetApp.openById(
SECOND_OLD_SAFETY_TRAINING_SHEET_ID
);
const secondSheet = secondSpreadSheet
.getSheets()
.find(
(sheet) => sheet.getSheetId() === SECOND_OLD_SAFETY_TRAINING_SHEET_GID
);
const secondLastRow = secondSheet.getLastRow();
const secondRange = secondSheet.getRange(1, 2, secondLastRow);
const secondValues = secondRange.getValues();

const combinedValues = [...values, ...secondValues];
return combinedValues;
};

0 comments on commit 7d1f2f1

Please sign in to comment.