From 7217faced7a7432ba2b9b9a58cd16e12794f7f5b Mon Sep 17 00:00:00 2001 From: Aswanth Vc Date: Thu, 6 Jun 2024 23:03:57 +0530 Subject: [PATCH] fix (leaderboard) : Data Fetch --- api/launchpad/launchpad_views.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/api/launchpad/launchpad_views.py b/api/launchpad/launchpad_views.py index aaae402e..7970df66 100644 --- a/api/launchpad/launchpad_views.py +++ b/api/launchpad/launchpad_views.py @@ -25,17 +25,15 @@ def get(self, request): task__hashtag='#lp24-introduction', ).values('user') + allowed_org_types = UserOrganizationLink.objects.filter( + org__org_type__in=["College", "School", "Company"]) + + users = User.objects.filter( karma_activity_log_user__task__event="launchpad", karma_activity_log_user__appraiser_approved=True, id__in=intro_task_completed_users, - ).prefetch_related( - Prefetch( - "user_organization_link_user", - queryset=UserOrganizationLink.objects.filter( - org__org_type__in=["College", "School", "Company"] - ), - ) + user_organization_link_org__in=allowed_org_types, ).annotate( karma=Subquery(total_karma_subquery, output_field=IntegerField()), org=F("user_organization_link_user__org__title"),