Skip to content

Commit

Permalink
#244 Get paid values from Payments instead of Offers
Browse files Browse the repository at this point in the history
  • Loading branch information
tonylampada committed Jan 10, 2014
1 parent a47a149 commit 7a8430c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions djangoproject/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,12 @@ def getTotalPaidPriceBTC(self):
return self.getTotalPaidPrice_by_currency('BTC')

def getTotalPaidPrice_by_currency(self, currency):
offers = Offer.objects.filter(issue=self, status=Offer.PAID, currency=currency)
payments = Payment.objects.filter(status__in=[Payment.CONFIRMED_IPN, Payment.CONFIRMED_TRN],
offer__issue=self,
currency=currency)
s = Decimal(0)
for offer in offers:
s = s + offer.price
for payment in payments:
s = s + payment.total
return twoplaces(s)

def touch(self):
Expand Down

0 comments on commit 7a8430c

Please sign in to comment.