Skip to content

Commit

Permalink
Safety training
Browse files Browse the repository at this point in the history
  • Loading branch information
rlho committed Mar 14, 2024
1 parent 708698d commit ce69883
Showing 1 changed file with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,28 @@ const SheetEditor = () => {
// safety training users
const getSafetyTrainingStudents = () => {
if (!isSafetyTrained) {
serverFunctions.getSheetRows(SAFTY_TRAINING_SHEET_NAME).then((rows) => {
const emails = rows.reduce(
(accumulator, value) => accumulator.concat(value),
[]
);
const trained = emails.includes(userEmail);
setIsSafetyTrained(trained);
});
serverFunctions.getOldSafetyTrainingEmails().then((rows) => {
console.log('old emails', rows);
const emails = rows.reduce(
(accumulator, value) => accumulator.concat(value),
[]
);
const trained = emails.includes(userEmail);
setIsSafetyTrained(trained);
});
const trained = serverFunctions
.getSheetRows(SAFTY_TRAINING_SHEET_NAME)
.then((rows) => {
const emails = rows.reduce(
(accumulator, value) => accumulator.concat(value),
[]
);
const trained = emails.includes(userEmail);
setIsSafetyTrained(trained);
return trained;
});
if (!trained) {
serverFunctions.getOldSafetyTrainingEmails().then((rows) => {
console.log('old emails', rows);
const emails = rows.reduce(
(accumulator, value) => accumulator.concat(value),
[]
);
const trained = emails.includes(userEmail);
setIsSafetyTrained(trained);
});
}
}
};

Expand Down

0 comments on commit ce69883

Please sign in to comment.