Adopt fix in groups price calculator
This commit is contained in:
+10
-10
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user