Fixed up scheduling logic using UTC dates instead of local dates. Updated scheduling header. Fixed month view not showing. BOD-179
This commit is contained in:
@@ -35,7 +35,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
const { arrJobs, compJobs } = result.data;
|
||||
|
||||
arrJobs.forEach((item) => {
|
||||
const itemDate = moment(item.scheduled_in).toISOString().substr(0, 10);
|
||||
const itemDate = moment(item.scheduled_in).format("yyyy-MM-DD");
|
||||
if (!!load[itemDate]) {
|
||||
load[itemDate].hoursIn =
|
||||
(load[itemDate].hoursIn || 0) +
|
||||
@@ -44,7 +44,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
load[itemDate].jobsIn.push(item);
|
||||
} else {
|
||||
load[itemDate] = {
|
||||
jobsIn: [],
|
||||
jobsIn: [item],
|
||||
jobsOut: [],
|
||||
hoursIn:
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
@@ -54,9 +54,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
});
|
||||
|
||||
compJobs.forEach((item) => {
|
||||
const itemDate = moment(item.scheduled_completion)
|
||||
.toISOString()
|
||||
.substr(0, 10);
|
||||
const itemDate = moment(item.scheduled_completion).format("yyyy-MM-DD");
|
||||
if (!!load[itemDate]) {
|
||||
load[itemDate].hoursOut =
|
||||
(load[itemDate].hoursOut || 0) +
|
||||
@@ -65,6 +63,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
load[itemDate].jobsOut.push(item);
|
||||
} else {
|
||||
load[itemDate] = {
|
||||
jobsOut: [item],
|
||||
hoursOut:
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs,
|
||||
@@ -75,20 +74,19 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
//Propagate the expected load to each day.
|
||||
const range = Math.round(moment.duration(end.diff(today)).asDays());
|
||||
for (var day = 0; day < range; day++) {
|
||||
const current = moment(today)
|
||||
.add(day, "days")
|
||||
.toISOString()
|
||||
.substr(0, 10);
|
||||
const current = moment(today).add(day, "days").format("yyyy-MM-DD");
|
||||
const prev = moment(today)
|
||||
.add(day - 1, "days")
|
||||
.toISOString()
|
||||
.substr(0, 10);
|
||||
.format("yyyy-MM-DD");
|
||||
if (!!!load[current]) {
|
||||
load[current] = {};
|
||||
}
|
||||
if (day === 0) {
|
||||
//Starting on day 1. The load is current.
|
||||
load[current].expectedLoad = load.productionHoursTotal;
|
||||
load[current].expectedLoad =
|
||||
load.productionHoursTotal +
|
||||
(load[current].hoursIn || 0) -
|
||||
(load[current].hoursOut || 0);
|
||||
} else {
|
||||
load[current].expectedLoad =
|
||||
load[prev].expectedLoad +
|
||||
@@ -96,7 +94,6 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
(load[current].hoursOut || 0);
|
||||
}
|
||||
}
|
||||
|
||||
yield put(scheduleLoadSuccess(load));
|
||||
} catch (error) {
|
||||
//console.log("Error in sendEmailFailure saga.", error.message);
|
||||
|
||||
Reference in New Issue
Block a user