From df7c14442eb3ac24dcc9fffff3804ccba6effc91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
Date: Wed, 25 Mar 2026 20:55:35 +0100
Subject: [PATCH] Fixed bug in real income
---
app/Resources/EventResource.php | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/app/Resources/EventResource.php b/app/Resources/EventResource.php
index cb9210c..184e798 100644
--- a/app/Resources/EventResource.php
+++ b/app/Resources/EventResource.php
@@ -225,20 +225,16 @@ class EventResource extends JsonResource{
}
public function calculateIncomes(array $participants, Amount $supportPerPerson) : array {
- $expectedAmount = $supportPerPerson;
+ $expectedAmount = new Amount($supportPerPerson->getAmount(), 'Euro');
$expectedAmount->addAmount($this->event->support_flat);
- $realAmount = $supportPerPerson;
+ $realAmount = new Amount($supportPerPerson->getAmount(), 'Euro');
$realAmount->addAmount($this->event->support_flat);
-
-
foreach ($participants as $participationType => $participantData) {
$expectedAmount->addAmount(new Amount($participantData['amount']['expected']['value'], 'Euro'));
$realAmount->addAmount(new Amount($participantData['amount']['paid']['value'], 'Euro'));
}
-
-
return ['real' => [
'amount' => $realAmount,
'readable' => $realAmount->toString()
@@ -252,7 +248,11 @@ class EventResource extends JsonResource{
public function getParticipants(string $participationType) : array {
$returnData = [];
- $returnData['amount'] = ['expected' => new Amount(0, 'Euro'), 'paid' => new Amount(0, 'Euro')];
+ $returnData['amount'] = [
+ 'expected' => new Amount(0, 'Euro'),
+ 'paid' => new Amount(0, 'Euro')
+ ];
+
$returnData['count'] = 0;
foreach ($this->event->participants()->where(
@@ -288,7 +288,6 @@ class EventResource extends JsonResource{
'readable' => $returnData['amount']['paid']->toString()
];
-
return $returnData;
}