feat(team-leaderboard): Add achievement badges and ranking system for team members
This merge request introduces a gamification system to the Team Leaderboard feature by adding achievement badges and ranking徽章 (badges) that recognize individual and team performance.
Changes Made
1. New Badge SVG Assets (assets/badges/)
2. Modified modes/team_leaderboard.py
New Functions:
-
_build_individual_rows(team_data)– Flattens all team members into a single ranked list and assigns achievement badges -
_load_rank_badge_svg(rank)– Loads SVG markup for rank badges (1-6) from multiple fallback directories -
_load_individual_badge_svg(badge_name)– Loads SVG markup for achievement badges
Badge Assignment Logic:
- Maximum 3 badges per member
- Team Player: Highest scorer in each team receives this badge
- Sprint Star: Member with highest overall score
- Top Committer: Member with most total commits
- Merge Master: Member with most merged MRs
- Hackathon Hero: Member with highest combined total (commits + MRs + issues)
- Consistency Champ: Member with lowest variance in activity (most consistent)
Rendering Updates:
-
_build_ranking_rows()now includes rank badges in the team ranking display - Updated table rendering with custom HTML/CSS for badge visualization
Score Formula
The existing score formula remains unchanged:
score = (total_commits × 1) + (merged_mrs × 5) + (total_mrs × 2) + (issues_closed × 3)
Testing
Test coverage added in tests/test_modes_team_leaderboard.py for:
- Badge row extraction and aggregation
- JSON validation
- Badge loading functions
- Individual member row building with badges
Breaking Changes
None. This is a backward-compatible enhancement.
Target Branch: feature-final
Source Branch: badges/bhavitha