PM-5834 - add support for live leaderboard scoring based on ai decissions - #132
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request updates the Topcoder leaderboard report to optionally return real-time (provisional) scores for ongoing challenges and to expose additional challenge metadata needed by the frontend.
Changes:
- Added
showRealtimeScorequery parameter and plumbed it into the leaderboard SQL query. - Updated the leaderboard SQL to return challenge status and AI-only challenge flag, and to switch score source based on realtime vs final scoring rules.
- Extended the leaderboard response shape to include per-challenge scores with an
isProvisionalflag per user.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/reports/topcoder/topcoder-reports.service.ts | Accepts/showRealtimeScore, passes it into SQL params, and returns per-challenge scores with provisional metadata. |
| src/reports/topcoder/dto/leaderboard-generic.dto.ts | Adds showRealtimeScore boolean query param parsing/validation. |
| sql/reports/topcoder/leaderboard-generic.sql | Adds challenge status + AI-only flags and toggles between AI decision vs final review score depending on realtime mode and completion status. |
Suppressed comments (2)
sql/reports/topcoder/leaderboard-generic.sql:126
- This realtime-score condition uses
cc.challenge_status <> 'COMPLETED', which is NULL whenchallenge_statusis NULL. UsingIS DISTINCT FROMensures NULL is treated as “not completed” and keeps realtime scoring consistent.
WHEN ($2::boolean = TRUE AND cc.challenge_status <> 'COMPLETED') OR challenge_reviewers.is_ai_only_challenge
sql/reports/topcoder/leaderboard-generic.sql:135
- Same NULL-status issue here:
cc.challenge_status <> 'COMPLETED'becomes NULL when status is NULL, so the AI-decision filter may not apply as intended. PreferIS DISTINCT FROMfor correct boolean behavior with NULLs.
OR ($2::boolean = TRUE AND cc.challenge_status <> 'COMPLETED'))
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| COALESCE( | ||
| CASE | ||
| WHEN challenge_reviewers.is_ai_only_challenge | ||
| OR ($2::boolean = TRUE AND cc.challenge_status <> 'COMPLETED') |
| score: number; | ||
| submittedDate: string; | ||
| placement: number; | ||
| challengeStatus: string; |
Comment on lines
1014
to
1018
| const query = this.sql.load("reports/topcoder/leaderboard-generic.sql"); | ||
| const rows = await this.db.query<LeaderboardGenericRow>(query, [ | ||
| filters.challengeIds, | ||
| filters.showRealtimeScore === true, | ||
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the Topcoder leaderboard report to support real-time (provisional) scoring and exposes additional challenge metadata. The main changes include updating the SQL query and TypeScript service to allow toggling between final and real-time scores, tracking whether a challenge is AI-only, and providing richer data to the frontend.
Leaderboard scoring and challenge status enhancements:
showRealtimeScoreboolean parameter to the leaderboard API and DTO, allowing clients to request real-time (provisional) scores instead of only final scores (src/reports/topcoder/dto/leaderboard-generic.dto.ts,src/reports/topcoder/topcoder-reports.service.ts) [1] [2].showRealtimeScoreis enabled and the challenge is not completed, and to includechallenge_statusandis_ai_only_challengein the result set (sql/reports/topcoder/leaderboard-generic.sql) [1] [2] [3] [4] [5].TypeScript model and response updates:
LeaderboardGenericRowtype and leaderboard API response to includechallengeStatusandisAiOnlyChallengefields, and to track per-challenge scores (including whether each score is provisional) for each user (src/reports/topcoder/topcoder-reports.service.ts) [1] [2] [3] [4] [5].These changes allow the leaderboard to provide more accurate and timely information, especially for ongoing challenges and AI-only competitions.