починил скидку за лояльность - не учитывалось что количество потраченных денег лежит во вложенной структуре wallet
This commit is contained in:
parent
0f687b5643
commit
017a4b26f1
@ -11,6 +11,7 @@ export function calcIndividualTariffPrices(
|
||||
priceBeforeDiscounts: number;
|
||||
priceAfterDiscounts: number;
|
||||
} {
|
||||
console.log('MAGIC', purchasesAmount)
|
||||
const priceBeforeDiscounts =
|
||||
tariff.price ||
|
||||
tariff.privileges.reduce(
|
||||
@ -46,6 +47,7 @@ export function calcIndividualTariffPrices(
|
||||
priceAfterDiscounts *= findDiscountFactor(cart.appliedLoyaltyDiscount);
|
||||
priceAfterDiscounts *= findDiscountFactor(cart.appliedCartPurchasesDiscount);
|
||||
|
||||
console.log("OLOLOLOLO", cart, discounts, purchasesAmount, tariff)
|
||||
// cart.allAppliedDiscounts.forEach((discount) => {
|
||||
// priceAfterDiscounts *= findDiscountFactor(discount)
|
||||
// })
|
||||
|
@ -16,11 +16,12 @@ export const createTariffElements = (
|
||||
const tariffElements = filteredTariffs
|
||||
.filter((tariff) => tariff.privileges.length > 0)
|
||||
.map((tariff, index) => {
|
||||
console.log('USSSSSES', user)
|
||||
const { priceBeforeDiscounts, priceAfterDiscounts } =
|
||||
calcIndividualTariffPrices(
|
||||
tariff,
|
||||
discounts,
|
||||
user.purchasesAmount,
|
||||
user.wallet.spent,
|
||||
[],
|
||||
user.isUserNko,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user