Skip to content
Snippets Groups Projects
Commit bfed64c3 authored by Todd Dembrey's avatar Todd Dembrey Committed by Fredrik Jonsson
Browse files

Lint: order and stop weird "as" behaviour

parent 0697b161
No related branches found
No related tags found
No related merge requests found
......@@ -14,16 +14,16 @@ from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models import (
Count,
Case,
F,
Count,
ExpressionWrapper,
F,
Max,
OuterRef,
Q,
Subquery,
Sum,
Value as V,
Value,
When,
)
from django.db.models.functions import Cast, Coalesce
......@@ -182,7 +182,7 @@ class PaymentRequestQueryset(models.QuerySet):
return self.exclude(status=DECLINED)
def total_value(self, field):
return self.aggregate(total=Coalesce(Sum(field), V(0)))['total']
return self.aggregate(total=Coalesce(Sum(field), Value(0)))['total']
def paid_value(self):
return self.filter(status=PAID).total_value('paid_value')
......@@ -309,7 +309,7 @@ class ProjectQuerySet(models.QuerySet):
def with_amount_paid(self):
return self.annotate(
amount_paid=Coalesce(Sum('payment_requests__paid_value'), V(0)),
amount_paid=Coalesce(Sum('payment_requests__paid_value'), Value(0)),
)
def with_last_payment(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment