Merge pull request #1758 from Safelite/feature/CSR-1971
CSR-1971 | Update line item ID syncing to avoid duplicates
This commit is contained in:
commit
8f8a1fe308
1 changed files with 7 additions and 1 deletions
|
|
@ -2831,12 +2831,18 @@ function syncLineItemIds(lineItemsWithoutIds, lineItemsWithIds) {
|
|||
if (!lineItemsWithIds || !lineItemsWithoutIds) {
|
||||
return;
|
||||
}
|
||||
var clonedLineItemsWithIds = deepClone(lineItemsWithIds);
|
||||
lineItemsWithoutIds.forEach((noId) => {
|
||||
lineItemsWithIds.forEach((withId) => {
|
||||
var matchedLineItemIndex = -1;
|
||||
clonedLineItemsWithIds.forEach((withId, index) => {
|
||||
if (noId.partNumber === withId.partNumber && noId.partType === withId.partType) {
|
||||
matchedLineItemIndex = index;
|
||||
noId.id = withId.id;
|
||||
}
|
||||
});
|
||||
if (matchedLineItemIndex > -1) {
|
||||
clonedLineItemsWithIds.splice(matchedLineItemIndex, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue