From 9ee40e1eebda2517e341e5024c4840e3c230652c Mon Sep 17 00:00:00 2001 From: Brad Campbell Date: Tue, 6 Sep 2016 13:15:28 -0400 Subject: [PATCH] count only the archived balance when user archived fixes issue where admin panel displayed wrong amount for total archived balances --- chezbetty/models/user.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chezbetty/models/user.py b/chezbetty/models/user.py index 93afaf6..e89fa91 100644 --- a/chezbetty/models/user.py +++ b/chezbetty/models/user.py @@ -268,6 +268,7 @@ def get_amount_owed(cls): def get_debt_forgiven(cls): return DBSession.query(func.sum(User.archived_balance).label("total_balance"))\ .filter(User.archived_balance<0)\ + .filter(User.archived==True)\ .one().total_balance or Decimal(0.0) # Sum the amount of user balances that we have tentatively absorbed into the @@ -276,6 +277,7 @@ def get_debt_forgiven(cls): def get_amount_absorbed(cls): return DBSession.query(func.sum(User.archived_balance).label("total_balance"))\ .filter(User.archived_balance>0)\ + .filter(User.archived==True)\ .one().total_balance or Decimal(0.0) @classmethod