FilteringAndSorting - IEEE-Team-3/map GitHub Wiki
This system allows users to filter and sort the leaderboard by various criteria such as points, tasks completed, and rank.
- Points Range: Filter users within a specific range of points.
- Task Completion Status: Filter users based on whether they have completed a certain number of tasks.
- Time Period: Filter based on performance within a specific time period (e.g., weekly, monthly).
- Highest Points: Sort leaderboard by total points.
- Tasks Completed: Sort leaderboard by the number of tasks completed.
- Rank: Sort by rank (ascending or descending).
function filterLeaderboard(criteria) {
return Leaderboard.find(criteria).sort({ points: -1 });
}
function sortLeaderboard(criteria) {
return Leaderboard.find().sort({ [criteria]: -1 });
}
Users can choose to filter or sort the leaderboard by points or other factors to see who has performed the best in different areas.