PM-4620 - fix report for member details - #130
Merged
Merged
Conversation
There was a problem hiding this comment.
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(...), ''), ...)inmember_profiles(country-member-details) to preferhomeCountryCode. - Reordered the same
COALESCElogic inwinners_country(first-place-by-country) to preferhomeCountryCode. - Reordered
COALESCElogic in both thewinner_profilesprojection and its non-null filter (top-winners-by-country) to preferhomeCountryCode.
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.
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 updates the logic for determining a member's country code in several SQL report queries. The main change is to prioritize
homeCountryCodeovercompetitionCountryCodewhen both are present or non-empty. This ensures consistency in how country codes are assigned across different reports.Country code selection logic update:
general/country-member-details.sql, themember_profilesCTE now useshomeCountryCodefirst in theCOALESCEexpression forcountry_code.general/first-place-by-country.sql, thewinners_countryCTE now prioritizeshomeCountryCodeovercompetitionCountryCodeforcountry_code.general/top-winners-by-country.sql, both thewinner_profilesCTE and itsWHEREclause now usehomeCountryCodebeforecompetitionCountryCodein theCOALESCEexpressions forcountry_code. [1] [2]