From 2f11ad48c0e5ab4176cd8164c3b1a972d4f24cef Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 5 Aug 2020 10:11:07 -0700 Subject: [PATCH] Fixed bug introduced by removing productionview table in scheduling BOD-243 --- client/src/graphql/appointments.queries.js | 24 ++++++++++++++++--- .../redux/application/application.sagas.js | 4 ++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/client/src/graphql/appointments.queries.js b/client/src/graphql/appointments.queries.js index 5b6bf73b5..a3c73fed1 100644 --- a/client/src/graphql/appointments.queries.js +++ b/client/src/graphql/appointments.queries.js @@ -113,14 +113,32 @@ export const QUERY_APPOINTMENTS_BY_JOBID = gql` `; export const QUERY_SCHEDULE_LOAD_DATA = gql` query QUERY_SCHEDULE_LOAD_DATA($start: timestamptz!, $end: timestamptz!) { - productionview_aggregate { + labhrs: joblines_aggregate( + where: { + mod_lbr_ty: { _eq: "LAB" } + job: { inproduction: { _eq: true } } + } + ) { aggregate { sum { - larhrs - labhrs + 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 } } ) { diff --git a/client/src/redux/application/application.sagas.js b/client/src/redux/application/application.sagas.js index 2892bad68..d48ea9d69 100644 --- a/client/src/redux/application/application.sagas.js +++ b/client/src/redux/application/application.sagas.js @@ -28,8 +28,8 @@ export function* calculateScheduleLoad({ payload: end }) { let load = { productionHoursTotal: - result.data.productionview_aggregate.aggregate.sum.larhrs + - result.data.productionview_aggregate.aggregate.sum.labhrs, + result.data.larhrs.aggregate.sum.mod_lb_hrs + + result.data.labhrs.aggregate.sum.mod_lb_hrs, }; const { arrJobs, compJobs } = result.data;