fix: incorrect calculation of total price in groups price calculator

addresses #8699m6vw6
This commit is contained in:
Björn Fromme
2025-07-01 17:02:05 +02:00
parent 600cf8f3cb
commit 9687febb2c
@@ -170,8 +170,8 @@
<td>{{ formatCurrency(priceBoard) }}</td> <td>{{ formatCurrency(priceBoard) }}</td>
</tr> </tr>
<tr class="odd:bg-zinc-100" <tr class="odd:bg-zinc-100"
v-if="(priceBoard.EUR > 0 || priceBoard.CHF > 0) && (pricePax.undersubscription.EUR > 0 || pricePax.undersubscription.CHF > 0)"> v-if="false === isSelfCatering && undersubscriptionLimit > 0">
<th class="text-left py-2">Verpflegungs-Aufschlag für Gruppen unter 50 Personen</th> <th class="text-left py-2">Verpflegungs-Aufschlag für Gruppen unter {{ undersubscriptionLimit }} Personen</th>
<td>{{ formatCurrency(pricePax.undersubscription) }}</td> <td>{{ formatCurrency(pricePax.undersubscription) }}</td>
</tr> </tr>
<tr class="odd:bg-zinc-100" <tr class="odd:bg-zinc-100"
@@ -619,7 +619,7 @@ export default {
isSelfCatering() { isSelfCatering() {
let selectedBoard = this.selectedBoard let selectedBoard = this.selectedBoard
if (null === selectedBoard) { if (null === selectedBoard) {
return false return true
} }
if ('CH' === this.countryCode) { if ('CH' === this.countryCode) {
return selectedBoard.price.CHF === 0 return selectedBoard.price.CHF === 0
@@ -627,6 +627,15 @@ export default {
return selectedBoard.price.EUR === 0 return selectedBoard.price.EUR === 0
} }
}, },
undersubscriptionLimit() {
if (this.paxCount < 40) {
return 40
} else if (this.paxCount < 50) {
return 50
}
return 0
},
paxCount() { paxCount() {
// subtract number of children from pax for price calculation, but minimum 30 pax // subtract number of children from pax for price calculation, but minimum 30 pax
return Math.max(this.selectedPax - this.childrenCount, 30) return Math.max(this.selectedPax - this.childrenCount, 30)
@@ -671,12 +680,14 @@ export default {
} }
} }
} }
if (false === this.isSelfCatering && this.paxCount < 40) { if (false === this.isSelfCatering) {
undersubscription.EUR = this.paxCount * this.undersubscription30Eur * this.selectedRange.length if (this.paxCount < 40) {
undersubscription.CHF = this.paxCount * this.undersubscription30Chf * this.selectedRange.length undersubscription.EUR = this.paxCount * this.undersubscription30Eur * this.selectedRange.length
} else if (false === this.isSelfCatering && this.paxCount < 50) { undersubscription.CHF = this.paxCount * this.undersubscription30Chf * this.selectedRange.length
undersubscription.EUR = this.paxCount * this.undersubscription40Eur * this.selectedRange.length } else if (this.paxCount < 50) {
undersubscription.CHF = this.paxCount * this.undersubscription40Chf * this.selectedRange.length undersubscription.EUR = this.paxCount * this.undersubscription40Eur * this.selectedRange.length
undersubscription.CHF = this.paxCount * this.undersubscription40Chf * this.selectedRange.length
}
} }
return {base, additional, undersubscription} return {base, additional, undersubscription}