Skip to content

Commit

Permalink
chore: Filter leaderboard users with zero points
Browse files Browse the repository at this point in the history
```
  • Loading branch information
Mic-R committed Jul 27, 2024
1 parent 61923b3 commit 403fed1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/endpoint/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
handler: async (request, reply) => {
let users = await prisma.user.findMany();
users = users.sort((a, b) => b.points - a.points);
users = users.filter((user) => user.points > 0);
const builds = await prisma.build.findMany();
let points = 0;
users.forEach((user) => {
Expand Down
1 change: 1 addition & 0 deletions buttons/leader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
};
});
users = users.sort((a, b) => b.points - a.points);
users = users.filter((user) => user.points > 0);
users = users.slice(pageNum * 10, pageNum * 10 + 10)

if(users.length === 0) {
Expand Down

0 comments on commit 403fed1

Please sign in to comment.