Resolved blocked day scheduling issue in smart scheduling IO-478
This commit is contained in:
@@ -198,6 +198,7 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
|
|||||||
start
|
start
|
||||||
isintake
|
isintake
|
||||||
id
|
id
|
||||||
|
block
|
||||||
job {
|
job {
|
||||||
joblines_aggregate {
|
joblines_aggregate {
|
||||||
aggregate {
|
aggregate {
|
||||||
|
|||||||
@@ -68,20 +68,26 @@ exports.job = async (req, res) => {
|
|||||||
|
|
||||||
//Populate the jobs scheduled to come in.
|
//Populate the jobs scheduled to come in.
|
||||||
appointments.forEach((appointment) => {
|
appointments.forEach((appointment) => {
|
||||||
const jobHrs =
|
if (!appointment.block) {
|
||||||
appointment.job.joblines_aggregate.aggregate.sum.mod_lb_hrs;
|
const jobHrs =
|
||||||
//Is the job in the same bucket?
|
appointment.job.joblines_aggregate.aggregate.sum.mod_lb_hrs;
|
||||||
const appointmentBucket = ssbuckets.filter(
|
//Is the job in the same bucket?
|
||||||
(bucket) =>
|
const appointmentBucket = ssbuckets.filter(
|
||||||
bucket.gte <= jobHrs && (!!bucket.lt ? bucket.lt > jobHrs : true)
|
(bucket) =>
|
||||||
)[0];
|
bucket.gte <= jobHrs && (!!bucket.lt ? bucket.lt > jobHrs : true)
|
||||||
if (appointmentBucket.id === JobBucket.id) {
|
)[0];
|
||||||
//Theyre the same classification. Add it to the matrix.
|
if (appointmentBucket.id === JobBucket.id) {
|
||||||
|
//Theyre the same classification. Add it to the matrix.
|
||||||
|
const appDate = moment(appointment.start).format("yyyy-MM-DD");
|
||||||
|
bucketMatrix[appDate] = {
|
||||||
|
...bucketMatrix[appDate],
|
||||||
|
in: bucketMatrix[appDate].in + 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//remove the date from the possible list.
|
||||||
const appDate = moment(appointment.start).format("yyyy-MM-DD");
|
const appDate = moment(appointment.start).format("yyyy-MM-DD");
|
||||||
bucketMatrix[appDate] = {
|
delete bucketMatrix[appDate];
|
||||||
...bucketMatrix[appDate],
|
|
||||||
in: bucketMatrix[appDate].in + 1,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -123,15 +129,6 @@ exports.job = async (req, res) => {
|
|||||||
possibleDates.push(new Date(bmkey).toISOString().substr(0, 10));
|
possibleDates.push(new Date(bmkey).toISOString().substr(0, 10));
|
||||||
});
|
});
|
||||||
|
|
||||||
//Temp
|
|
||||||
// possibleDates.push(new Date());
|
|
||||||
// possibleDates.push(new Date());
|
|
||||||
// possibleDates.push(new Date());
|
|
||||||
// possibleDates.push(new Date());
|
|
||||||
// possibleDates.push(new Date());
|
|
||||||
//Get a list of upcoming appointments
|
|
||||||
//Get the config for each day
|
|
||||||
|
|
||||||
res.json(possibleDates);
|
res.json(possibleDates);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("error", error);
|
console.log("error", error);
|
||||||
|
|||||||
Reference in New Issue
Block a user