HighlightingLogic - IEEE-Team-3/map GitHub Wiki

Overview

The leaderboard will include highlighting logic to visually distinguish top performers, recent changes, or other notable achievements. These highlights improve user engagement and highlight top players.

Highlight Criteria

  1. Top Performers: Users in the top 10 will have their rank highlighted with a distinct color.
  2. Recent Changes: Users who have recently improved their rank or points will be highlighted.
  3. Milestones: Users who achieve specific milestones (e.g., 100 tasks completed) will be highlighted.
  4. Penalty: Users who lose points will have their score highlighted with a warning color.

Example Backend Logic

function highlightLeaderboardEntries() {
  Leaderboard.find({ rank: { $lte: 10 } })
    .then(entries => {
      entries.forEach(entry => {
        entry.highlight = 'top-performer';
        entry.save();
      });
    });
}

function applyMilestoneHighlight(userId) {
  const user = Leaderboard.findOne({ userId });
  if (user.completedTasks >= 100) {
    user.highlight = 'milestone';
    user.save();
  }
}

Highlight Display

Highlights will be visually represented in the frontend with special colors or badges. For example, users in the top 10 could have their names displayed in gold.

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