From 7c26bc29aa4a7a6b815562433f71c16b1b041e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Mon, 23 Aug 2021 17:15:00 +0200 Subject: [PATCH] Fix another use of improper total pax value in groups price calculator --- .../Domain/Model/GroupsPriceConfig.php | 8 ++--- .../js/components/GroupsPriceCalculator.vue | 32 +++++++++++++------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php index 4a59d058..4f9cd902 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php @@ -143,7 +143,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPerson(): float + public function getPriceAdditionalPerson(): ?float { return $this->priceAdditionalPerson; } @@ -159,7 +159,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPersonGroup1(): float + public function getPriceAdditionalPersonGroup1(): ?float { return $this->priceAdditionalPersonGroup1; } @@ -175,7 +175,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPersonGroup2(): float + public function getPriceAdditionalPersonGroup2(): ?float { return $this->priceAdditionalPersonGroup2; } @@ -191,7 +191,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable /** * @return float */ - public function getPriceAdditionalPersonGroup3(): float + public function getPriceAdditionalPersonGroup3(): ?float { return $this->priceAdditionalPersonGroup3; } diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue index 6ce0ede4..b65c2023 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue @@ -36,13 +36,13 @@
- -
+
Erst ab 30 Personen buchbar.
@@ -170,7 +170,20 @@ export default { options: { type: Array, required: true - } + }, + runningCostsFactor: { + type: Number, + default: 1.7, + }, + shortTermFactors: { + type: Object, + default() { + return { + 2: 0.2, + 3: 0.1, + } + } + }, }, data() { return { @@ -239,7 +252,7 @@ export default { this.selectedRange = range; }, onPaxUpdated() { - if (this.selectedPax < 30) { + if (this.totalPax < 30) { this.selectedBoard = null; } }, @@ -371,11 +384,10 @@ export default { priceShortTerm() { let price = 0; const totalPricePax = (this.pricePax.base + this.pricePax.additional); - if (2 === this.nightsCount) { - price = totalPricePax * 0.2; - } - if (3 === this.nightsCount) { - price = totalPricePax * 0.1; + for (let [nights, factor] of Object.entries(this.shortTermFactors)) { + if (nights === this.nightsCount) { + price = totalPricePax * factor; + } } return price; }, @@ -383,7 +395,7 @@ export default { if (this.selectedBoard) { return 0; } - return this.nightsCount * this.totalPax * 1.7; + return this.nightsCount * this.totalPax * this.runningCostsFactor; }, priceTotal() { return this.pricePax.base + this.pricePax.additional + this.priceOptions