CSR-1452 | Formatting

This commit is contained in:
Scott Kiener 2023-11-13 14:07:10 -05:00
parent 0a9e59bf22
commit 7b7bd5da87
2 changed files with 20 additions and 6 deletions

View file

@ -246,7 +246,10 @@ export function getVapsThatNeedToBeAddedToSatisfyPromos(
} }
} }
export function removeCurrentlyActivePromoCodesFromInactivePromos(activePromoObjects, inactivePromos) { export function removeCurrentlyActivePromoCodesFromInactivePromos(
activePromoObjects,
inactivePromos
) {
activePromoObjects = activePromoObjects ?? []; activePromoObjects = activePromoObjects ?? [];
inactivePromos = inactivePromos ?? []; inactivePromos = inactivePromos ?? [];
const activePromoCodes = activePromoObjects.map((promoObject) => const activePromoCodes = activePromoObjects.map((promoObject) =>

View file

@ -23,8 +23,10 @@ import {
getDisplayTextForDurationLength, getDisplayTextForDurationLength,
} from "@/layouts/schedule/helpers/schedule-helper"; } from "@/layouts/schedule/helpers/schedule-helper";
import { paymentMethods } from "@/constants/payment-method-constants"; import { paymentMethods } from "@/constants/payment-method-constants";
import { getPromoCodeWithoutBundleIdentifier, import {
removeCurrentlyActivePromoCodesFromInactivePromos } from "@/helpers/promotions-helper"; getPromoCodeWithoutBundleIdentifier,
removeCurrentlyActivePromoCodesFromInactivePromos,
} from "@/helpers/promotions-helper";
import { getDateDifferenceInDays } from "@/helpers/date-helper"; import { getDateDifferenceInDays } from "@/helpers/date-helper";
// Export State // Export State
const getDefaultState = () => { const getDefaultState = () => {
@ -2132,7 +2134,10 @@ export const actions = {
} else if (activePromos && inactivePromos) { } else if (activePromos && inactivePromos) {
// Prioritize active promos when both inactive and active are supplied // Prioritize active promos when both inactive and active are supplied
activePromosToSave = activePromos; activePromosToSave = activePromos;
inactivePromosToSave = removeCurrentlyActivePromoCodesFromInactivePromos(activePromosToSave, inactivePromos); inactivePromosToSave = removeCurrentlyActivePromoCodesFromInactivePromos(
activePromosToSave,
inactivePromos
);
} else if (!activePromos) { } else if (!activePromos) {
// Only inactivePromos supplied // Only inactivePromos supplied
inactivePromosToSave = inactivePromos; inactivePromosToSave = inactivePromos;
@ -2144,7 +2149,10 @@ export const actions = {
} else if (!inactivePromos) { } else if (!inactivePromos) {
// Only activePromos supplied // Only activePromos supplied
activePromosToSave = activePromos; activePromosToSave = activePromos;
inactivePromosToSave = removeCurrentlyActivePromoCodesFromInactivePromos(activePromosToSave, context.getters.payment.inactivePromos ?? []) inactivePromosToSave = removeCurrentlyActivePromoCodesFromInactivePromos(
activePromosToSave,
context.getters.payment.inactivePromos ?? []
);
} }
context.commit(storeMutations.UPDATE_PROMOS, activePromosToSave); context.commit(storeMutations.UPDATE_PROMOS, activePromosToSave);
context.commit(storeMutations.UPDATE_INACTIVE_PROMOS, inactivePromosToSave); context.commit(storeMutations.UPDATE_INACTIVE_PROMOS, inactivePromosToSave);
@ -2346,7 +2354,10 @@ export const actions = {
lineItemsToUse.promos = activePromosToUse; lineItemsToUse.promos = activePromosToUse;
inactivePromosToUse = inactivePromosToUse ?? order.payment.inactivePromos; inactivePromosToUse = inactivePromosToUse ?? order.payment.inactivePromos;
inactivePromosToUse = removeCurrentlyActivePromoCodesFromInactivePromos(lineItemsToUse.promos, inactivePromosToUse); inactivePromosToUse = removeCurrentlyActivePromoCodesFromInactivePromos(
lineItemsToUse.promos,
inactivePromosToUse
);
let requestObject = { let requestObject = {
inactivePromos: inactivePromosToUse, inactivePromos: inactivePromosToUse,