From 7a8430c7baad41705af9ebaa3b15570d92fc75ed Mon Sep 17 00:00:00 2001 From: Tony Lampada Date: Fri, 10 Jan 2014 20:50:09 -0200 Subject: [PATCH] #244 Get paid values from Payments instead of Offers --- djangoproject/core/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/djangoproject/core/models.py b/djangoproject/core/models.py index bc3791ad..d44fb904 100644 --- a/djangoproject/core/models.py +++ b/djangoproject/core/models.py @@ -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):