Merged in feature/2021-07-09 (pull request #130)

feature/2021-07-09

Approved-by: Patrick Fic
This commit is contained in:
Patrick Fic
2021-07-07 22:14:01 +00:00
4 changed files with 17 additions and 24 deletions

View File

@@ -11,6 +11,7 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
query: GET_ALL_JOBLINES_BY_PK, query: GET_ALL_JOBLINES_BY_PK,
variables: { id: jobId }, variables: { id: jobId },
}); });
const existingLines = _.cloneDeep(existingLinesFromDb); const existingLines = _.cloneDeep(existingLinesFromDb);
const linesToInsert = []; const linesToInsert = [];
const linesToUpdate = []; const linesToUpdate = [];
@@ -19,11 +20,14 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
const matchingIndex = existingLines.findIndex( const matchingIndex = existingLines.findIndex(
(eL) => eL.unq_seq === newLine.unq_seq (eL) => eL.unq_seq === newLine.unq_seq
); );
//Should do a check to make sure there is only 1 matching unq sequence number.
if (matchingIndex >= 0) { if (matchingIndex >= 0) {
//Found a relevant matching line. Add it to lines to update. //Found a relevant matching line. Add it to lines to update.
linesToUpdate.push({ linesToUpdate.push({
id: existingLines[matchingIndex].id, id: existingLines[matchingIndex].id,
newData: newLine, newData: { ...newLine, removed: false },
}); });
//Splice out item we found for performance. //Splice out item we found for performance.

View File

@@ -23,19 +23,6 @@ export const GET_ALL_JOBLINES_BY_PK = gql`
notes notes
location location
tax_part tax_part
parts_order_lines {
id
parts_order {
id
order_number
order_date
user_email
vendor {
id
name
}
}
}
} }
} }
`; `;

View File

@@ -17,12 +17,13 @@ exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => {
if (isThreeTier) { if (isThreeTier) {
//It's always gonna be the owner now. Same as 2 tier by name //It's always gonna be the owner now. Same as 2 tier by name
return jobs_by_pk.ownr_co_nm return jobs_by_pk.ownr_co_nm
? `${jobs_by_pk.ownr_co_nm} - ${jobs_by_pk.ownr_ln || ""} ${ ? `${jobs_by_pk.ownr_co_nm.substring(0, 30)} #${
jobs_by_pk.ownr_fn || ""
} #${jobs_by_pk.owner.accountingid || ""}`
: `${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""} #${
jobs_by_pk.owner.accountingid || "" jobs_by_pk.owner.accountingid || ""
}`; }`
: `${`${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""}`.substring(
0,
30
)} #${jobs_by_pk.owner.accountingid || ""}`;
} else { } else {
//What's the 2 tier pref? //What's the 2 tier pref?
if (twotierpref === "source") { if (twotierpref === "source") {
@@ -31,12 +32,12 @@ exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => {
} else { } else {
//Same as 3 tier //Same as 3 tier
return jobs_by_pk.ownr_co_nm return jobs_by_pk.ownr_co_nm
? `${jobs_by_pk.ownr_co_nm} - ${jobs_by_pk.ownr_ln || ""} ${ ? `${jobs_by_pk.ownr_co_nm.substring(0, 30)} #${
jobs_by_pk.ownr_fn || ""
} #${jobs_by_pk.owner.accountingid || ""}`
: `${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""} #${
jobs_by_pk.owner.accountingid || "" jobs_by_pk.owner.accountingid || ""
}`; }`
: `${`${jobs_by_pk.ownr_ln || ""} ${
jobs_by_pk.ownr_fn || ""
}`.substring(0, 30)} #${jobs_by_pk.owner.accountingid || ""}`;
} }
} }
}; };

View File

@@ -57,6 +57,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
ownerid ownerid
ownr_ln ownr_ln
ownr_fn ownr_fn
ownr_co_nm
ownr_addr1 ownr_addr1
ownr_addr2 ownr_addr2
ownr_zip ownr_zip