Conversation
What was broken The Engagement Data report could export the wrong country or null for some members because it did not follow the same location precedence as the Profile app. Root cause The engagement member enrichment SQL only resolved country from competition-country data and the denormalized member country field, so it ignored home-country data that the Profile app prefers. What was changed Updated the engagement member enrichment SQL to resolve country names through the lookups country table with homeCountryCode first, then competitionCountryCode, then the stored member country fallback. Updated the engagement report service documentation to reflect the profile-aligned country precedence. Any added/updated tests Added src/reports/topcoder/topcoder-reports.sql.spec.ts to lock the Engagement Data country precedence in focused SQL regression coverage.
What was broken The Engagement Data report could still show the wrong country or null for some members after the first QA follow-up. Members whose profile location resolved from home or competition country codes could still export the stale legacy country value instead. Root cause The previous fix expanded the SQL lookup coverage, but it still collapsed country resolution into a single SQL field that fell back to members.member.country. That legacy field can be stale and does not match how the profile UI resolves member location. What was changed Split engagement member enrichment into separate home-country and competition-country resolution fields plus the raw profile country codes. Resolved the final export country in the report service with the same home-country-first precedence the profile UI uses, and removed the stale members.member.country fallback. Expanded SQL coverage to resolve country names through both lookups.Country and identity.country so legacy alpha-2, alpha-3, and lookup-id values still map correctly. Updated the report documentation to match the current country sources. Any added/updated tests Updated src/reports/topcoder/topcoder-reports.service.spec.ts to cover the profile-style country precedence for the report output. Updated src/reports/topcoder/topcoder-reports.sql.spec.ts to lock the SQL against falling back to members.member.country.
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.
What was broken
The Engagement Data report could still show the wrong country or null for some members after the first QA follow-up. Members whose profile location resolved from home or competition country codes could still export the stale legacy country value instead.
Root cause
The previous fix expanded the SQL lookup coverage, but it still collapsed country resolution into a single SQL field that fell back to members.member.country. That legacy field can be stale and does not match how the profile UI resolves member location.
What was changed
Split engagement member enrichment into separate home-country and competition-country resolution fields plus the raw profile country codes.
Resolved the final export country in the report service with the same home-country-first precedence the profile UI uses, and removed the stale members.member.country fallback.
Expanded SQL coverage to resolve country names through both lookups.Country and identity.country so legacy alpha-2, alpha-3, and lookup-id values still map correctly.
Updated the report documentation to match the current country sources.
Any added/updated tests
Updated src/reports/topcoder/topcoder-reports.service.spec.ts to cover the profile-style country precedence for the report output.
Updated src/reports/topcoder/topcoder-reports.sql.spec.ts to lock the SQL against falling back to members.member.country.
Validated with
pnpm lint,pnpm build,pnpm test -- src/reports/topcoder/topcoder-reports.service.spec.ts src/reports/topcoder/topcoder-reports.sql.spec.ts, andpnpm test.Full
pnpm teststill fails on existing SFDC suites already red ondevelop:src/reports/sfdc/sfdc-reports.dto.spec.ts,src/reports/sfdc/sfdc-reports.module.spec.ts,src/reports/sfdc/sfdc-reports.controller.spec.ts, andsrc/reports/sfdc/sfdc-reports.service.spec.ts.