CSR-2179: refactor to protect against missing supportingItems

This commit is contained in:
Adam Caouette 2024-09-11 19:37:45 -04:00
parent f6f048cdca
commit 76b85d2064

View file

@ -303,12 +303,11 @@ export default {
},
lineItemsWithoutRecal() {
if (!this.lineItems || this.lineItems.length < 1) return;
if (!this.lineItems.supportingItems) return this.lineItems;
const lineItemsCopy = deepClone(this.lineItems);
lineItemsCopy.supportingItems = baseMixin.methods.filterOutRecalibration(
lineItemsCopy.supportingItems
);
lineItemsCopy.supportingItems = lineItemsCopy.supportingItems ? baseMixin.methods.filterOutRecalibration(
lineItemsCopy?.supportingItems
) : [];
return lineItemsCopy;
},
showCoverageAsPending() {
@ -1000,6 +999,11 @@ export default {
},
subTotal() {
if (!this.lineItems || this.lineItems.length < 1) return;
if (this.isInsurance || !this.shouldHideRecalibration) {
console.log(" first this.lineItems: ", this.lineItems)
} else {
console.log(" 2nd this.lineItemsWithoutRecal: ", this.lineItemsWithoutRecal)
}
return this.isInsurance || !this.shouldHideRecalibration
? baseMixin.methods.getSubTotal(this.lineItems) // calculate with recal (if on order)
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculated without recal