SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit af2afa38 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

replace children subsidy annotation with property

parent 1deed332
No related branches found
No related tags found
No related merge requests found
...@@ -138,9 +138,7 @@ class OrganizationQuerySet(models.QuerySet): ...@@ -138,9 +138,7 @@ class OrganizationQuerySet(models.QuerySet):
has_children_with_current_subsidy=Exists( has_children_with_current_subsidy=Exists(
Subsidy.objects.filter(organization__in=models.OuterRef("children")) Subsidy.objects.filter(organization__in=models.OuterRef("children"))
.obtained() .obtained()
.filter( .filter(date_until__gte=timezone.now())
date_until__gte=timezone.now(),
)
) )
) )
......
...@@ -270,7 +270,6 @@ class OrganizationListView(PaginationMixin, ListView): ...@@ -270,7 +270,6 @@ class OrganizationListView(PaginationMixin, ListView):
qs = ( qs = (
qs.annot_has_current_subsidy() qs.annot_has_current_subsidy()
.annot_has_children_with_current_subsidy()
.annot_has_any_subsidy() .annot_has_any_subsidy()
.prefetch_related("logos", "children") .prefetch_related("logos", "children")
.select_related("parent") .select_related("parent")
...@@ -289,7 +288,8 @@ class OrganizationListView(PaginationMixin, ListView): ...@@ -289,7 +288,8 @@ class OrganizationListView(PaginationMixin, ListView):
qs = qs.order_by("cf_balance_info__cumulative__impact_on_reserves") qs = qs.order_by("cf_balance_info__cumulative__impact_on_reserves")
if ordering == "desc": if ordering == "desc":
qs = qs.reverse() qs = qs.reverse()
return qs.distinct()
return qs
def get_organization_detail(request): def get_organization_detail(request):
......
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