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,
},
shortTermFactors: {
type: Object,
type: Array,
default() {
return {
2: 0.2,
3: 0.1,
}
return [
{ nights: 1, factor: 0.3 },
{ nights: 2, factor: 0.2 },
{ nights: 3, factor: 0.1 },
]
}
},
},
@@ -463,11 +464,10 @@ export default {
},
priceShortTerm() {
let price = 0;
const totalPricePax = (this.pricePax.base + this.pricePax.additional);
for (let [nights, factor] of Object.entries(this.shortTermFactors)) {
if (nights === this.nightsCount) {
price = totalPricePax * factor;
}
const totalPricePax = this.pricePax.base + this.pricePax.additional;
const shorTermFactor = this.shortTermFactors.find(element => element.nights === this.nightsCount);
if (undefined !== shorTermFactor) {
price = totalPricePax * shorTermFactor.factor;
}
return price;
},