Skip to content

Commit

Permalink
Merge pull request #1503 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
kkem clg wise rpt
  • Loading branch information
adnankattekaden authored Nov 2, 2023
2 parents f63911d + a1ebe72 commit c92682e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions api/common/common_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def get(self, request):
request,
search_fields=["first_name", "last_name", "muid", "circle_name", 'circle_ig', "organisation", "dwms_id",
"karma_earned"],
sort_fields={"first_name": "first_name", "muid": "muid", "circle_name": "circle_name",
sort_fields={"first_name": "first_name", "last_name": "last_name", "muid": "muid",
"circle_name": "circle_name",
"circle_ig": "circle_ig", "organisation": "organisation", "dwms_id": "dwms_id",
"karma_earned": "karma_earned"},
)
Expand Down Expand Up @@ -206,7 +207,7 @@ def get(self, request):
LearningCircle.objects.filter(org__org_type=OrganizationType.COLLEGE.value, created_at__date=date)
.values(org_title=F("org__title"))
.annotate(
learning_circle_count=Count("id"), user_count=Count("usercirclelink")
learning_circle_count=Count("id"), user_count=Count("user_circle_link_circle")
)
.order_by("org_title")
)
Expand All @@ -215,12 +216,24 @@ def get(self, request):
LearningCircle.objects.filter(org__org_type=OrganizationType.COLLEGE.value)
.values(org_title=F("org__title"))
.annotate(
learning_circle_count=Count("id"), user_count=Count("usercirclelink")
learning_circle_count=Count("id"), user_count=Count("user_circle_link_circle")
)
.order_by("org_title")
)

return CustomResponse(response=learning_circles_info).get_success_response()
paginated_queryset = CommonUtils.get_paginated_queryset(
learning_circles_info,
request,
search_fields=["org_title", "learning_circle_count", "user_count"],
sort_fields={"org_title": "org_title", "learning_circle_count": "learning_circle_count",
"user_count": "user_count"},
)

collegewise_info_data = CollegeInfoSerializer(paginated_queryset.get("queryset"), many=True).data

return CustomResponse().paginated_response(
data=collegewise_info_data, pagination=paginated_queryset.get("pagination")
)


class GlobalCountAPI(APIView):
Expand Down

0 comments on commit c92682e

Please sign in to comment.