From f28858e4a340f6b4b8709cd6cb2ab98f57d13d87 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Thu, 19 Aug 2021 10:47:33 +0200 Subject: [PATCH] fix posdetail view when no pos json yet --- src/economy/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/economy/models.py b/src/economy/models.py index 1f94e4a5..7946e241 100644 --- a/src/economy/models.py +++ b/src/economy/models.py @@ -853,9 +853,10 @@ class PosReport(CampRelatedModel, UUIDModel): """Calculate the total HAX sales and number of transactions.""" transactions = 0 total = 0 - for tx in self.pos_json: - transactions += 1 - total += tx["amount"] + if self.pos_json: + for tx in self.pos_json: + transactions += 1 + total += tx["amount"] return transactions, total @property