fix posdetail view when no pos json yet

This commit is contained in:
Thomas Steen Rasmussen 2021-08-19 10:47:33 +02:00
parent df10fc89c6
commit f28858e4a3
1 changed files with 4 additions and 3 deletions

View File

@ -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