Skip to content

Commit 10a52df

Browse files
committed
Remove cached property, for now
1 parent 77601c6 commit 10a52df

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

app/grandchallenge/challenges/models.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -938,26 +938,16 @@ def has_paid_prepaid_invoice(self):
938938
payment_status=PaymentStatusChoices.PAID,
939939
).exists()
940940

941-
@cached_property
942-
def compute_costs_balance_euros_millicents(self):
943-
return self._get_compute_costs_balance_euros_millicents(
944-
invoices=self.invoices.all()
945-
)
941+
@property
942+
def active_invoice(self):
943+
invoices = self.invoices.order_by("expires_on", "created")
946944

947-
def _get_compute_costs_balance_euros_millicents(self, *, invoices):
948-
return sum(
945+
total_balance = sum(
949946
invoice.compute_costs_balance_euros_millicents
950947
for invoice in invoices
951948
)
952949

953-
@property
954-
def active_invoice(self):
955-
invoices = self.invoices.order_by("expires_on", "created")
956-
957-
if (
958-
self._get_compute_costs_balance_euros_millicents(invoices=invoices)
959-
<= 0
960-
):
950+
if total_balance <= 0:
961951
raise InsufficientBudgetError
962952

963953
for invoice in invoices:

0 commit comments

Comments
 (0)