IO-2132 Add Weekly ATS Summary
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user