Improve eboutic readability

This commit is contained in:
2025-08-24 00:26:34 +02:00
parent 0bc18be75e
commit 25099528bf

View File

@@ -133,9 +133,7 @@ class EbouticMainView(LoginRequiredMixin, FormView):
context["products"] = self.products context["products"] = self.products
context["customer_amount"] = self.request.user.account_balance context["customer_amount"] = self.request.user.account_balance
purchase_times = [ purchases = (
int(purchase.timestamp() * 1000)
for purchase in (
Customer.objects.filter(pk=self.customer.pk) Customer.objects.filter(pk=self.customer.pk)
.annotate( .annotate(
last_refill=Subquery( last_refill=Subquery(
@@ -153,8 +151,12 @@ class EbouticMainView(LoginRequiredMixin, FormView):
.values("date")[:1] .values("date")[:1]
), ),
) )
.values("last_refill", "last_purchase") .values_list("last_refill", "last_purchase")
)[0].values() )[0]
purchase_times = [
int(purchase.timestamp() * 1000)
for purchase in purchases
if purchase is not None if purchase is not None
] ]