Update logic to ensure removed lines are always ignored. IO-733

This commit is contained in:
Patrick Fic
2021-03-05 09:34:18 -08:00
parent c4555f7441
commit 22f3f20882
5 changed files with 54 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
import { GET_JOB_LINES_BY_PK } from "../../graphql/jobs-lines.queries"; import { GET_ALL_JOBLINES_BY_PK } from "../../graphql/jobs-lines.queries";
import { gql } from "@apollo/client"; import { gql } from "@apollo/client";
import _ from "lodash"; import _ from "lodash";
@@ -8,7 +8,7 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
const { const {
data: { joblines: existingLinesFromDb }, data: { joblines: existingLinesFromDb },
} = await client.query({ } = await client.query({
query: GET_JOB_LINES_BY_PK, query: GET_ALL_JOBLINES_BY_PK,
variables: { id: jobId }, variables: { id: jobId },
}); });
const existingLines = _.cloneDeep(existingLinesFromDb); const existingLines = _.cloneDeep(existingLinesFromDb);

View File

@@ -10,6 +10,7 @@ export default function PartnerPingComponent() {
// Create an scoped async function in the hook // Create an scoped async function in the hook
async function checkPartnerStatus() { async function checkPartnerStatus() {
try { try {
if (process.env.NODE_ENV === "development") return;
const PartnerResponse = await axios.post("http://localhost:1337/ping/"); const PartnerResponse = await axios.post("http://localhost:1337/ping/");
const { appver, qbpath } = PartnerResponse.data; const { appver, qbpath } = PartnerResponse.data;
console.log({ appver, qbpath }); console.log({ appver, qbpath });

View File

@@ -1,7 +1,7 @@
import { gql } from "@apollo/client"; import { gql } from "@apollo/client";
export const GET_JOB_LINES_BY_PK = gql` export const GET_ALL_JOBLINES_BY_PK = gql`
query GET_JOB_LINES_BY_PK($id: uuid!) { query GET_ALL_JOBLINES_BY_PK($id: uuid!) {
joblines(where: { jobid: { _eq: $id } }, order_by: { line_no: asc }) { joblines(where: { jobid: { _eq: $id } }, order_by: { line_no: asc }) {
id id
line_no line_no
@@ -46,7 +46,7 @@ export const GET_LINE_TICKET_BY_PK = gql`
id id
lbr_adjustments lbr_adjustments
} }
joblines(where: { jobid: { _eq: $id } }) { joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }) {
id id
line_desc line_desc
part_type part_type
@@ -126,6 +126,7 @@ export const UPDATE_JOB_LINE = gql`
notes notes
location location
status status
removed
} }
} }
} }
@@ -133,7 +134,7 @@ export const UPDATE_JOB_LINE = gql`
export const GET_JOB_LINES_TO_ENTER_BILL = gql` export const GET_JOB_LINES_TO_ENTER_BILL = gql`
query GET_JOB_LINES_TO_ENTER_BILL($id: uuid!) { query GET_JOB_LINES_TO_ENTER_BILL($id: uuid!) {
joblines(where: { jobid: { _eq: $id } }) { joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }) {
id id
line_desc line_desc
part_type part_type

View File

@@ -115,7 +115,6 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
id id
status status
ro_number ro_number
ownr_fn ownr_fn
ownr_ln ownr_ln
v_model_yr v_model_yr
@@ -157,20 +156,27 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
first_name first_name
last_name last_name
} }
partcount: joblines_aggregate { partcount: joblines_aggregate(where: { removed: { _eq: false } }) {
nodes { nodes {
status status
} }
} }
labhrs: joblines_aggregate(
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) { where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
} }
} }
} }
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) { larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
@@ -196,14 +202,22 @@ export const QUERY_LBR_HRS_BY_PK = gql`
query QUERY_LBR_HRS_BY_PK($id: uuid!) { query QUERY_LBR_HRS_BY_PK($id: uuid!) {
jobs_by_pk(id: $id) { jobs_by_pk(id: $id) {
id id
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) { labhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
} }
} }
} }
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) { larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
@@ -484,7 +498,7 @@ export const GET_JOB_BY_PK = gql`
deliverchecklist deliverchecklist
voided voided
ca_bc_pvrt ca_bc_pvrt
joblines(where: { jobid: { _eq: $id } }, order_by: { line_no: asc }) { joblines(where: { removed: { _eq: false } }, order_by: { line_no: asc }) {
id id
line_no line_no
unq_seq unq_seq
@@ -1072,7 +1086,7 @@ export const QUERY_ALL_JOB_FIELDS = gql`
v_model_yr v_model_yr
v_vin v_vin
vehicleid vehicleid
joblines { joblines(where: { removed: { _eq: false } }) {
act_price act_price
alt_co_id alt_co_id
alt_overrd alt_overrd
@@ -1136,7 +1150,6 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
) { ) {
id id
ro_number ro_number
ownr_co_nm ownr_co_nm
ownr_fn ownr_fn
ownr_ln ownr_ln
@@ -1144,15 +1157,22 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
v_make_desc v_make_desc
v_model_desc v_model_desc
scheduled_completion scheduled_completion
labhrs: joblines_aggregate(
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" } }) { where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
} }
} }
} }
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) { larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs

View File

@@ -205,7 +205,7 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
target_touchtime target_touchtime
workingdays workingdays
} }
jobhrs: joblines_aggregate { jobhrs: joblines_aggregate(where: { removed: { _eq: false } }) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
@@ -219,7 +219,7 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
id id
block block
job { job {
joblines_aggregate { joblines_aggregate(where: { removed: { _eq: false } }) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
@@ -231,14 +231,22 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
jobs(where: {inproduction: {_eq: true}}) { jobs(where: {inproduction: {_eq: true}}) {
id id
scheduled_completion scheduled_completion
labhrs: joblines_aggregate(where: {mod_lbr_ty: {_neq: "LAR"}}) { labhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
} }
} }
} }
larhrs: joblines_aggregate(where: {mod_lbr_ty: {_eq: "LAR"}}) { larhrs: joblines_aggregate(
where: {
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
}
) {
aggregate { aggregate {
sum { sum {
mod_lb_hrs mod_lb_hrs
@@ -532,7 +540,7 @@ exports.GET_JOB_BY_PK = ` query GET_JOB_BY_PK($id: uuid!) {
deliverchecklist deliverchecklist
voided voided
ca_bc_pvrt ca_bc_pvrt
joblines{ joblines(where: { removed: { _eq: false } }){
id id
line_no line_no
unq_seq unq_seq