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 _ from "lodash";
@@ -8,7 +8,7 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
const {
data: { joblines: existingLinesFromDb },
} = await client.query({
query: GET_JOB_LINES_BY_PK,
query: GET_ALL_JOBLINES_BY_PK,
variables: { id: jobId },
});
const existingLines = _.cloneDeep(existingLinesFromDb);

View File

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

View File

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

View File

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

View File

@@ -205,7 +205,7 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
target_touchtime
workingdays
}
jobhrs: joblines_aggregate {
jobhrs: joblines_aggregate(where: { removed: { _eq: false } }) {
aggregate {
sum {
mod_lb_hrs
@@ -219,7 +219,7 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
id
block
job {
joblines_aggregate {
joblines_aggregate(where: { removed: { _eq: false } }) {
aggregate {
sum {
mod_lb_hrs
@@ -231,14 +231,22 @@ query QUERY_UPCOMING_APPOINTMENTS($now: timestamptz!, $jobId: uuid!) {
jobs(where: {inproduction: {_eq: true}}) {
id
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 {
sum {
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 {
sum {
mod_lb_hrs
@@ -532,7 +540,7 @@ exports.GET_JOB_BY_PK = ` query GET_JOB_BY_PK($id: uuid!) {
deliverchecklist
voided
ca_bc_pvrt
joblines{
joblines(where: { removed: { _eq: false } }){
id
line_no
unq_seq