Skip to content

PM-4620 - fix report for member details - #130

Merged
vas3a merged 1 commit into
developfrom
PM-4620_general-statistics
Aug 12, 2026
Merged

PM-4620 - fix report for member details#130
vas3a merged 1 commit into
developfrom
PM-4620_general-statistics

Conversation

@vas3a

@vas3a vas3a commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

This pull request updates the logic for determining a member's country code in several SQL report queries. The main change is to prioritize homeCountryCode over competitionCountryCode when both are present or non-empty. This ensures consistency in how country codes are assigned across different reports.

Country code selection logic update:

  • In general/country-member-details.sql, the member_profiles CTE now uses homeCountryCode first in the COALESCE expression for country_code.
  • In general/first-place-by-country.sql, the winners_country CTE now prioritizes homeCountryCode over competitionCountryCode for country_code.
  • In general/top-winners-by-country.sql, both the winner_profiles CTE and its WHERE clause now use homeCountryCode before competitionCountryCode in the COALESCE expressions for country_code. [1] [2]

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 country-code selection in several statistics SQL reports to consistently prefer a member’s homeCountryCode over competitionCountryCode when both are present (after trimming/empty-string normalization), aligning country attribution across reports.

Changes:

  • Reordered COALESCE(NULLIF(TRIM(...), ''), ...) in member_profiles (country-member-details) to prefer homeCountryCode.
  • Reordered the same COALESCE logic in winners_country (first-place-by-country) to prefer homeCountryCode.
  • Reordered COALESCE logic in both the winner_profiles projection and its non-null filter (top-winners-by-country) to prefer homeCountryCode.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
sql/reports/statistics/general/top-winners-by-country.sql Prefers homeCountryCode in winner country derivation and its non-null filter for consistent aggregation.
sql/reports/statistics/general/first-place-by-country.sql Prefers homeCountryCode when mapping winners to a country for first-place counts.
sql/reports/statistics/general/country-member-details.sql Prefers homeCountryCode in member profile country selection used for country/member breakdowns.

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

@vas3a
vas3a merged commit 397299d into develop Aug 12, 2026
6 checks passed
@vas3a
vas3a deleted the PM-4620_general-statistics branch August 12, 2026 11:25
@vas3a
vas3a restored the PM-4620_general-statistics branch August 12, 2026 11:25
@vas3a
vas3a deleted the PM-4620_general-statistics branch August 13, 2026 04:40
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