Skip to content

Commit

Permalink
Fixes discharged patients CSV export (#2010)
Browse files Browse the repository at this point in the history
* Fixes discharged patients CSV export

* default `is_active` to False
  • Loading branch information
rithviknishad authored Mar 25, 2024
1 parent e73b454 commit ce7073e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion care/facility/api/viewsets/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ 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)
is_active = self.request.GET.get("is_active", "False") == "True"
return queryset.filter(last_consultation__discharge_date__isnull=is_active)

return super().filter_queryset(queryset)

Expand Down

0 comments on commit ce7073e

Please sign in to comment.