forked from uncloud/uncloud
implement balance getting
This commit is contained in:
parent
1b06d8ee03
commit
6c15d2086e
7 changed files with 53 additions and 65 deletions
|
|
@ -68,16 +68,6 @@ class Currency(models.TextChoices):
|
|||
# USD = 'USD', _('US Dollar')
|
||||
|
||||
|
||||
def get_balance_for_user(user):
|
||||
bills = reduce(
|
||||
lambda acc, entry: acc + entry.total,
|
||||
Bill.objects.filter(owner=user),
|
||||
0)
|
||||
payments = reduce(
|
||||
lambda acc, entry: acc + entry.amount,
|
||||
Payment.objects.filter(owner=user),
|
||||
0)
|
||||
return payments - bills
|
||||
|
||||
###
|
||||
# Stripe
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue