Skip to content

Commit

Permalink
Handle potential None value from aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
shauryag2002 authored Dec 2, 2024
1 parent 42350b4 commit 5f85647
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion care/facility/api/viewsets/hospital_doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_facility(self):
def list(self, request, *args, **kwargs):
response = super().list(request, *args, **kwargs)
total_doctors = self.get_queryset().aggregate(total_doctors=Sum('count'))['total_doctors']
response.data["total_doctors"] = total_doctors
response.data["total_doctors"] = total_doctors or 0
return response

def perform_create(self, serializer):
Expand Down

0 comments on commit 5f85647

Please sign in to comment.