Skip to content

Commit

Permalink
Sort users by question count in descending order
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanVBW committed Nov 29, 2024
1 parent 2dae758 commit 329e792
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ app.get("/", async (req, res) => {
};
});

// Sort users by questionSolved in descending order
usersData.sort((a, b) => b.questionSolved - a.questionSolved);

res.render("index", { data: usersData });
} catch (error) {
console.error("Error fetching data:", error);
Expand Down

0 comments on commit 329e792

Please sign in to comment.