Skip to content

Commit

Permalink
count only the archived balance when user archived
Browse files Browse the repository at this point in the history
fixes issue where admin panel displayed wrong amount for total archived
balances
  • Loading branch information
bradjc committed Sep 6, 2016
1 parent 309daa1 commit 9ee40e1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chezbetty/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9ee40e1

Please sign in to comment.