IO-2132 Add Weekly ATS Summary

This commit is contained in:
Patrick Fic
2023-01-02 11:46:23 -08:00
parent d69ce2d2a9
commit 34f5fad365
8 changed files with 84 additions and 5 deletions

View File

@@ -136,10 +136,6 @@ export function* calculateScheduleLoad({ payload: end }) {
}
});
console.log(
"🚀 ~ file: application.sagas.js:160 ~ function*calculateScheduleLoad ~ load.productionTotal",
load.productionTotal
);
//Propagate the expected load to each day.
const range = Math.round(moment.duration(end.diff(today)).asDays());
for (var day = 0; day < range; day++) {
@@ -175,6 +171,22 @@ export function* calculateScheduleLoad({ payload: end }) {
(load[current].hoursOut || 0);
}
}
//Calculate weekly ATS summary.
const startOfWeek = moment(end).startOf("week");
const endOfWeek = moment(end).endOf("week");
load.atsSummary = {};
arrJobs
.filter((j) => moment(j.scheduled_in).isBetween(startOfWeek, endOfWeek))
.forEach((j) => {
if (!load.atsSummary[j.alt_transport]) {
load.atsSummary[j.alt_transport] = 1;
} else {
load.atsSummary[j.alt_transport] =
load.atsSummary[j.alt_transport] + 1;
}
});
yield put(setProblemJobs(problemJobs));
yield put(scheduleLoadSuccess(load));
} catch (error) {