Adopt fix in groups price calculator

This commit is contained in:
Björn Fromme
2022-02-09 09:56:15 +01:00
parent 3201e7e49c
commit 47ea384cf2
@@ -247,12 +247,13 @@ export default {
default: 1.7, default: 1.7,
}, },
shortTermFactors: { shortTermFactors: {
type: Object, type: Array,
default() { default() {
return { return [
2: 0.2, { nights: 1, factor: 0.3 },
3: 0.1, { nights: 2, factor: 0.2 },
} { nights: 3, factor: 0.1 },
]
} }
}, },
}, },
@@ -463,11 +464,10 @@ export default {
}, },
priceShortTerm() { priceShortTerm() {
let price = 0; let price = 0;
const totalPricePax = (this.pricePax.base + this.pricePax.additional); const totalPricePax = this.pricePax.base + this.pricePax.additional;
for (let [nights, factor] of Object.entries(this.shortTermFactors)) { const shorTermFactor = this.shortTermFactors.find(element => element.nights === this.nightsCount);
if (nights === this.nightsCount) { if (undefined !== shorTermFactor) {
price = totalPricePax * factor; price = totalPricePax * shorTermFactor.factor;
}
} }
return price; return price;
}, },