Skip to content

Implement priority-based scoring system with streaks and monthly leaderboards#5

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/improve-leaderboard-scoring-system
Draft

Implement priority-based scoring system with streaks and monthly leaderboards#5
Copilot wants to merge 4 commits intomainfrom
copilot/improve-leaderboard-scoring-system

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 31, 2025

Students are rewarded based on priority: (1) first to solve a problem, (2) optimal solution [reserved for future], (3) daily solve streaks, (4) monthly top 3 rankings.

Scoring Formula

total_points = (100 × difficulty × (2 if first_solve else 1)) + streak_bonus
streak_bonus = 10 × days + (weeks × 1.5 × base)

Examples: 1000-rated problem = 100 pts base, 200 pts if first solve. 7-day streak = 175 pts bonus, 14-day = 560 pts.

Database Changes

  • User: current_streak, longest_streak, last_solve_date, monthly_score, last_monthly_reset
  • MonthlyLeaderboard: Historical rankings with reward tracking (top 3: $50/$25/$10)
  • solves: Added solved_at timestamp for streak calculation

Implementation

  • bemo/scoring.py: Centralized scoring logic (update_user_streak, calculate_problem_score, update_monthly_score)
  • routes.py: Integrated into submission flow at line 540-569, added /leaderboard route
  • Fixed all-time leaderboard query (was ascending, now desc)

UI

Home page - Three-column layout: All-Time, Monthly (with 🥇🥈🥉), Contributors

Home Page

Leaderboard page - Tabbed view (Monthly/All-Time/Streaks) with scoring documentation

Leaderboard

Dashboard - Added current streak (🔥), longest streak, monthly score cards

Migration

Run migrate_scoring_system.py to add new columns and MonthlyLeaderboard table. Idempotent and backward compatible.

Future Work

Time complexity analysis (priority #2) requires Judge0 execution metrics integration - infrastructure prepared in scoring module for cascading rewards (O(n) earns O(n²) points but not O(1)).

See SCORING_SYSTEM.md for API documentation and IMPLEMENTATION_SUMMARY.md for deployment checklist.

Original prompt

Improve the leaderboard and scoring system; students should be rewarded for being the first to solve a problem at a time complexity, finding the optimal solution to a problem, being consistent and solving any problem in a streak, and being in the top 3 of the leaderboard every month in that order of importance. Determining the time complexity of a solution and optimal time complexity should be left for further development. If a student achieved O(n) complexity for example, they should get rewards for O(n^2) and beyond but O(1) should be left open.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 31, 2025
Copilot AI and others added 3 commits December 31, 2025 19:32
…ards

Co-authored-by: kushb007 <26575576+kushb007@users.noreply.github.com>
Co-authored-by: kushb007 <26575576+kushb007@users.noreply.github.com>
Co-authored-by: kushb007 <26575576+kushb007@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve leaderboard and scoring system for students Implement priority-based scoring system with streaks and monthly leaderboards Dec 31, 2025
Copilot AI requested a review from kushb007 December 31, 2025 19:40
Copy link
Copy Markdown
Owner

@kushb007 kushb007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scoring system should only apply to the first submission of an open time complexity. Once a time complexity is solves, it and all easier complexities are closed from scoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants