Skip to content

Commit

Permalink
Merge pull request #1910 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
Setting leaderboard to top 30
  • Loading branch information
jelanmathewjames authored Apr 15, 2024
2 parents 57f14f7 + 5cdd16a commit ff589e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/launchpad/launchpad_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def get(self, request):
tl.event = "launchpad" AND
kal.appraiser_approved = TRUE
GROUP BY u.id, u.full_name, org.title, comm.title, COALESCE(org.dis, d.name), COALESCE(org.state, s.name)
ORDER BY karma DESC, time_
LIMIT 30;
ORDER BY karma DESC, time_;
"""
with connection.cursor() as cursor:
cursor.execute(query)
Expand All @@ -58,7 +57,9 @@ def get(self, request):
user_ids = set()
list_of_dicts = []
for row in results:
if len(list_of_dicts) == 30:
break
if row[0] not in user_ids:
user_ids.add(row[0])
list_of_dicts.append(dict(zip(column_names, row)))
return CustomResponse(response=list_of_dicts).get_success_response()
return CustomResponse(response=list_of_dicts).get_success_response()

0 comments on commit ff589e1

Please sign in to comment.