Skip to content

PM-5834 - add support for live leaderboard scoring based on ai decissions - #132

Merged
vas3a merged 2 commits into
developfrom
PM-5834_live-leaderboard
Aug 13, 2026
Merged

PM-5834 - add support for live leaderboard scoring based on ai decissions#132
vas3a merged 2 commits into
developfrom
PM-5834_live-leaderboard

Conversation

@vas3a

@vas3a vas3a commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Added a new showRealtimeScore boolean 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].
  • Modified the SQL query to select and return real-time scores when showRealtimeScore is enabled and the challenge is not completed, and to include challenge_status and is_ai_only_challenge in the result set (sql/reports/topcoder/leaderboard-generic.sql) [1] [2] [3] [4] [5].

TypeScript model and response updates:

  • Extended the LeaderboardGenericRow type and leaderboard API response to include challengeStatus and isAiOnlyChallenge fields, 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 showRealtimeScore query 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 isProvisional flag 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 when challenge_status is NULL. Using IS DISTINCT FROM ensures 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. Prefer IS DISTINCT FROM for 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,
]);
@vas3a
vas3a merged commit b702798 into develop Aug 13, 2026
5 checks passed
@vas3a
vas3a deleted the PM-5834_live-leaderboard branch August 13, 2026 07:37
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