Skip to content

Commit

Permalink
fixes issues with patient annotate + distinct not implemented for csv…
Browse files Browse the repository at this point in the history
… export (#1999)

* fixes issues with annotate + distinct not implemented for csv export

* fixes #1998

* fix typo
  • Loading branch information
rithviknishad authored Mar 22, 2024
1 parent 6d68486 commit 8358849
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions care/facility/api/viewsets/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,14 @@ def get_serializer_class(self):
else:
return self.serializer_class

def filter_queryset(self, queryset: QuerySet) -> QuerySet:
if self.action == "list" and settings.CSV_REQUEST_PARAMETER in self.request.GET:
for backend in (PatientDRYFilter, filters.DjangoFilterBackend):
queryset = backend().filter_queryset(self.request, queryset, self)
return queryset.filter(last_consultation__discharge_date__isnull=True)

return super().filter_queryset(queryset)

def list(self, request, *args, **kwargs):
"""
Patient List
Expand Down

0 comments on commit 8358849

Please sign in to comment.