Skip to content

Commit

Permalink
Merge pull request #1353 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
kkem college wise report
  • Loading branch information
adnankattekaden authored Oct 17, 2023
2 parents cd6c06c + 2af7326 commit 2ca7b01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/common/common_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get(self, request):
learning_circle_count = LearningCircle.objects.all().count()
total_no_enrollment = UserCircleLink.objects.filter(accepted=True).count()
circle_count_by_ig = LearningCircle.objects.all().values(ig_name=F('ig__name')).annotate(
total_circles=Count('id'))
total_circles=Count('id'), total_users=Count('ig__learningcircle__usercirclelink__user', distinct=True))

unique_user_count = UserCircleLink.objects.filter(accepted=True).values('user').distinct().count()
return CustomResponse(response={'lc_count': learning_circle_count, 'total_enrollment': total_no_enrollment,
Expand Down Expand Up @@ -122,6 +122,16 @@ def get(self, request):
return CommonUtils.generate_csv(student_info_data, "Learning Circle Report")


class CollegeWiseLcReport(APIView):

def get(self, request):
learning_circles_info = LearningCircle.objects.filter(org__org_type=OrganizationType.COLLEGE.value).annotate(
user_count=Count('usercirclelink'),
org_name=F('org__title')
).values('name', 'user_count', 'org_name')
return CustomResponse(response=learning_circles_info).get_success_response()


class GlobalCountAPI(APIView):

def get(self, request):
Expand Down
1 change: 1 addition & 0 deletions api/common/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
urlpatterns = [
path('lc-dashboard/', common_views.LcDashboardAPI.as_view()),
path('lc-report/', common_views.LcReportAPI.as_view()),
path('college-wise-lc-report/', common_views.CollegeWiseLcReport.as_view()),
path('download/lc-report/', common_views.LcReportDownloadAPI.as_view()),
path('global-count/', common_views.GlobalCountAPI.as_view()),
]

0 comments on commit 2ca7b01

Please sign in to comment.