Begin refactoring smart schedule calculations.

This commit is contained in:
Patrick Fic
2020-10-08 13:42:56 -07:00
parent 630e8a32ed
commit 020bec3fa2
7 changed files with 185 additions and 74 deletions

View File

@@ -166,32 +166,23 @@ export const QUERY_APPOINTMENTS_BY_JOBID = gql`
`;
export const QUERY_SCHEDULE_LOAD_DATA = gql`
query QUERY_SCHEDULE_LOAD_DATA($start: timestamptz!, $end: timestamptz!) {
labhrs: joblines_aggregate(
where: {
mod_lbr_ty: { _eq: "LAB" }
job: { inproduction: { _eq: true } }
prodJobs: jobs(where: { inproduction: { _eq: true } }) {
id
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
) {
aggregate {
sum {
mod_lb_hrs
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
larhrs: joblines_aggregate(
where: {
mod_lbr_ty: { _eq: "LAR" }
job: { inproduction: { _eq: true } }
}
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
compJobs: jobs(
where: { scheduled_completion: { _gte: $start, _lte: $end } }
) {