IO-1613 add suspended days to jobs.

This commit is contained in:
Patrick Fic
2022-01-04 12:33:20 -08:00
parent fc023367cc
commit 6457acc61e
18 changed files with 170 additions and 24 deletions

View File

@@ -473,7 +473,7 @@ exports.QUERY_UPCOMING_APPOINTMENTS = `query QUERY_UPCOMING_APPOINTMENTS($now: t
start
block
}
arrJobs: jobs(where: {scheduled_in: {_gte: $now}}) {
arrJobs: jobs(where: {scheduled_in: {_gte: $now}, suspended: {_eq: false}}) {
id
scheduled_in
ro_number
@@ -492,7 +492,7 @@ exports.QUERY_UPCOMING_APPOINTMENTS = `query QUERY_UPCOMING_APPOINTMENTS($now: t
}
}
}
compJobs: jobs(where: {_or: [{scheduled_completion: {_gte: $now}}, {actual_completion: {_gte: $now}}]}) {
compJobs: jobs(where: {_and: [{suspended: {_eq: false}}, {_or: [{scheduled_completion: {_gte: $now}}, {actual_completion: {_gte: $now}}]}]}) {
id
ro_number
scheduled_completion
@@ -512,7 +512,7 @@ exports.QUERY_UPCOMING_APPOINTMENTS = `query QUERY_UPCOMING_APPOINTMENTS($now: t
}
}
}
prodJobs: jobs(where: {inproduction: {_eq: true}}) {
prodJobs: jobs(where: {inproduction: {_eq: true}, suspended: {_eq: false}}) {
id
scheduled_completion
labhrs: joblines_aggregate(where: {_and: [{mod_lbr_ty: {_neq: "LAR"}}, {removed: {_eq: false}}]}) {
@@ -530,11 +530,7 @@ exports.QUERY_UPCOMING_APPOINTMENTS = `query QUERY_UPCOMING_APPOINTMENTS($now: t
}
}
}
}
`;
}`;
exports.QUERY_EMPLOYEE_PIN = `query QUERY_EMPLOYEE_PIN($shopId: uuid!, $employeeId: String!) {
employees(where: {_and: {shopid: {_eq: $shopId}, employee_number: {_eq: $employeeId}}}) {

View File

@@ -140,6 +140,7 @@ exports.job = async (req, res) => {
...filteredCompJobs
.map((p) => moment(p.actual_completion || p.scheduled_completion))
.filter((p) => p.isValid() && p.isAfter(yesterday)),
moment().add(5, "days"),
]);
const range = Math.round(moment.duration(end.diff(today)).asDays());
for (var day = 0; day < range; day++) {