INSR-9513: Remove console.log, handle multiple recal parts in price calc
This commit is contained in:
parent
4fbca5ccd8
commit
2be1a91e16
2 changed files with 3 additions and 3 deletions
|
|
@ -165,8 +165,9 @@ export function getCartTotal(order) {
|
|||
export function getRecalibrationTotal(order) {
|
||||
const itemsWithRecalibration = getServiceLineItems(order)
|
||||
.filter((item) => item.requiresRecalibration);
|
||||
const recalibrationLineItems = itemsWithRecalibration.map((item) => {
|
||||
return item.childParts?.find((child) => child.partType === partTypeStrings.RECALIBRATION || child.partType === partTypeStrings.ADAS_RECALIBRATION) ?? {};
|
||||
|
||||
const recalibrationLineItems = itemsWithRecalibration.flatMap((item) => {
|
||||
return item.childParts?.filter((child) => child.partType === partTypeStrings.RECALIBRATION || child.partType === partTypeStrings.ADAS_RECALIBRATION) ?? [];
|
||||
});
|
||||
|
||||
return getPriceOfLineItems(recalibrationLineItems);
|
||||
|
|
|
|||
|
|
@ -1133,7 +1133,6 @@ export const useMainStore = defineStore({
|
|||
if (glassPart) {
|
||||
for (const recalPartInformation of recalPartArray) {
|
||||
const recalChildPart = glassPart.childParts?.find((cp) => cp.partNumber === recalPartInformation.partNumber);
|
||||
console.log('Existing recalibration child part found', recalChildPart);
|
||||
if (!recalChildPart) {
|
||||
if (!Array.isArray(glassPart.childParts) || !glassPart.childParts.length) {
|
||||
glassPart.childParts = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue