Skip to content

PM-4800: align engagement report country with profile#79

Closed
jmgasper wants to merge 1 commit intodevelopfrom
PM-4800-1
Closed

PM-4800: align engagement report country with profile#79
jmgasper wants to merge 1 commit intodevelopfrom
PM-4800-1

Conversation

@jmgasper
Copy link
Copy Markdown
Collaborator

What was broken
QA found that the Engagement Data report could still show the wrong country or null for some members even after the original PM-4800 report was added. The remaining examples were members whose Profile app location showed a home-country value like Japan or Sri Lanka while the export showed Aruba or null.

Root cause
The engagement member enrichment SQL was resolving country from competition-country data and the denormalized member country field instead of following the Profile app's home-country-first fallback order.

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.
Validated with pnpm test -- src/reports/topcoder/topcoder-reports.service.spec.ts src/reports/topcoder/topcoder-reports.sql.spec.ts, pnpm lint, and pnpm build.
Full pnpm test still fails on existing SFDC suites already red on develop: src/reports/sfdc/sfdc-reports.dto.spec.ts, src/reports/sfdc/sfdc-reports.module.spec.ts, src/reports/sfdc/sfdc-reports.controller.spec.ts, and src/reports/sfdc/sfdc-reports.service.spec.ts.

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.
@jmgasper jmgasper closed this Apr 13, 2026
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.

1 participant