Skip to content

Commit

Permalink
userpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj-tekdi committed Jan 14, 2025
1 parent d1dd203 commit 31e920e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/adapters/hasura/altProgramAssociation.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,7 @@ export class ALTProgramAssociationService {
className: data.Group[0]?.name || "",
points: userEntry.User.totalPoints?.aggregate?.sum?.points || 0,
}))
.filter(user => user.points > 0)
.sort((a, b) => b.points - a.points) // Sort by points in descending order
.map((user, index) => ({
...user,
Expand Down Expand Up @@ -1903,6 +1904,9 @@ export class ALTProgramAssociationService {
points: userEntry.User.totalPoints?.aggregate?.sum?.points || 0,
}))
);

// Remove users with 0 points
topUsers = topUsers.filter(user => user.points > 0);

// Sort topUsers by points in descending order
topUsers = topUsers.sort((a, b) => b.points - a.points);
Expand Down

0 comments on commit 31e920e

Please sign in to comment.