From 971146fac52ac30b60d47e70717b097fd256964d Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Wed, 13 Apr 2022 23:56:25 +0200
Subject: [PATCH] Fix total amount calculation for event registrations with
 donations

---
 aleksis/apps/paweljong/models.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/aleksis/apps/paweljong/models.py b/aleksis/apps/paweljong/models.py
index b804416..1a5239b 100644
--- a/aleksis/apps/paweljong/models.py
+++ b/aleksis/apps/paweljong/models.py
@@ -358,11 +358,12 @@ class EventRegistration(ExtensibleModel):
             )
 
     def _get_total_amount(self):
-        total, tax = 0, 0
+        total, total_tax = 0, 0
         for item in self.get_purchased_items():
-            tax += item.price * item.tax_rate / 100
+            tax = item.price * item.tax_rate / 100
             total += item.price + tax
-        return total, tax
+            total_tax += tax
+        return total, total_tax
 
     def __str__(self) -> str:
         return f"{self.event}, {self.person.first_name} {self.person.last_name}"
-- 
GitLab