Skip to content

PM-6430 - Update campus leaderboard - fetch challenges in parent group - #166

Merged
vas3a merged 1 commit into
developfrom
PM-6430_campus-leaderboard
Oct 5, 2026
Merged

vas3a merged 1 commit into
developfrom
PM-6430_campus-leaderboard

Conversation

@vas3a

@vas3a vas3a commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

This pull request updates the campus-leaderboard.sql report to improve how campus challenges are identified. It now ensures that challenges restricted to both a campus group and its parent groups are flagged as campus challenges. This change provides a more accurate leaderboard by including all relevant challenges.

Campus challenge identification improvements:

  • Added logic to include challenges restricted to both the campus group and its parent group(s) as campus challenges, ensuring more comprehensive reporting.
  • Introduced the parent_groups and campus_groups CTEs to aggregate group IDs from the campus group and its parent groups, and updated subsequent group identifier logic to use this expanded set.

@vas3a
vas3a requested a balanced review from Copilot October 5, 2026 05:22

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.

Copilot review overview

🔵 Needs a closer look

The new parent_groups CTE resolves only immediate parents while group_tree recurses, so correctness depends on group-hierarchy depth semantics that need human verification against the intended leaderboard behavior.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR updates the campus-leaderboard.sql report so that challenges restricted to a campus group's parent group(s) are also flagged as campus challenges. Previously only challenges restricted to the resolved campus group (and its descendants' identifiers) were counted. The change introduces two new CTEs (parent_groups, campus_groups) and feeds their combined identifiers into the existing group_identifiers set used by the is_campus_challenge flag, aiming for more comprehensive campus reporting.

Changes:

  • Added parent_groups CTE to resolve the campus group's parent group(s) via GroupMember.
  • Added campus_groups CTE that unions the root group with its parent group(s), and switched group_identifiers to draw from it.
  • Updated the header comment to document that parent-group-restricted challenges are flagged as campus challenges.
File Description
sql/​reports/​topcoder/​campus-leaderboard.sql Adds parent_groups/campus_groups CTEs and expands the campus challenge identifier set to include parent-group identifiers; updates header comment.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +36 to +44
parent_groups AS (
SELECT g.id, g."oldId"
FROM groups."GroupMember" AS gm
JOIN root_group AS rg
ON rg.id = gm."memberId"
JOIN groups."Group" AS g
ON g.id = gm."groupId"
WHERE LOWER(gm."membershipType") = 'group'
),
@vas3a
vas3a merged commit 9ab5e4e into develop Oct 5, 2026
6 checks passed
@vas3a
vas3a deleted the PM-6430_campus-leaderboard branch October 5, 2026 05:30
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