FilteringAndSorting - IEEE-Team-3/map GitHub Wiki

Overview

This system allows users to filter and sort the leaderboard by various criteria such as points, tasks completed, and rank.

Available Filters

  1. Points Range: Filter users within a specific range of points.
  2. Task Completion Status: Filter users based on whether they have completed a certain number of tasks.
  3. Time Period: Filter based on performance within a specific time period (e.g., weekly, monthly).

Sorting Options

  1. Highest Points: Sort leaderboard by total points.
  2. Tasks Completed: Sort leaderboard by the number of tasks completed.
  3. Rank: Sort by rank (ascending or descending).

Example Backend Logic

function filterLeaderboard(criteria) {
  return Leaderboard.find(criteria).sort({ points: -1 });
}

function sortLeaderboard(criteria) {
  return Leaderboard.find().sort({ [criteria]: -1 });
}

Example Use Case

Users can choose to filter or sort the leaderboard by points or other factors to see who has performed the best in different areas.

⚠️ **GitHub.com Fallback** ⚠️