IO-1241 Supplement Merge with discarded changes.
This commit is contained in:
@@ -11,6 +11,7 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
||||
query: GET_ALL_JOBLINES_BY_PK,
|
||||
variables: { id: jobId },
|
||||
});
|
||||
|
||||
const existingLines = _.cloneDeep(existingLinesFromDb);
|
||||
const linesToInsert = [];
|
||||
const linesToUpdate = [];
|
||||
@@ -19,11 +20,14 @@ export const GetSupplementDelta = async (client, jobId, newLines) => {
|
||||
const matchingIndex = existingLines.findIndex(
|
||||
(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) {
|
||||
//Found a relevant matching line. Add it to lines to update.
|
||||
linesToUpdate.push({
|
||||
id: existingLines[matchingIndex].id,
|
||||
newData: newLine,
|
||||
newData: { ...newLine, removed: false },
|
||||
});
|
||||
|
||||
//Splice out item we found for performance.
|
||||
|
||||
@@ -23,19 +23,6 @@ export const GET_ALL_JOBLINES_BY_PK = gql`
|
||||
notes
|
||||
location
|
||||
tax_part
|
||||
parts_order_lines {
|
||||
id
|
||||
parts_order {
|
||||
id
|
||||
order_number
|
||||
order_date
|
||||
user_email
|
||||
vendor {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user