Skip to content

PM-5458: Use placement history for profile win counts#1999

Merged
jmgasper merged 1 commit into
devfrom
PM-5458
Jul 1, 2026
Merged

PM-5458: Use placement history for profile win counts#1999
jmgasper merged 1 commit into
devfrom
PM-5458

Conversation

@jmgasper

@jmgasper jmgasper commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What was broken
Member profile stats could show stale win totals for Development and AI Engineering when the aggregate win count disagreed with the placement history displayed on the profile.

Root cause
The profiles aggregation helper preferred any nonzero aggregate win count over placement history. When the aggregate was stale, the UI could show second-place finishes as wins or miss additional first-place history rows.

What was changed
Subtrack summaries now use placement-bearing history as the authoritative source for wins and only fall back to aggregate wins when history has no placement data. The compact Member Stats block now passes stats history into the same aggregation path used by detail pages.

Any added/updated tests
Added regression tests for stale nonzero aggregate wins being overridden by placement history and for preserving aggregate wins when legacy history rows have no placement data.

Validation run:

  • yarn test:no-watch src/apps/profiles/src/hooks/useFetchActiveTracks.spec.tsx
  • yarn test:no-watch src/apps/profiles/src/components/tc-achievements/MemberStatsBlock/MemberStatsBlock.spec.tsx
  • yarn lint
  • yarn build

Full yarn test:no-watch was also run. The profiles tests passed, but the full repo run still fails in unrelated apps/work suites that are outside this change, including engagement-editor.schema.spec.ts, PaymentFormModal.spec.tsx, and ChallengeEditorForm.spec.tsx.

What was broken
Member profile stats could show stale win totals for Development and AI Engineering when the stats aggregate disagreed with the placement history shown on the same profile screens.

Root cause
The profiles aggregation helper trusted any nonzero aggregate win count before consulting history, so stale aggregates could count non-first placements as wins or undercount first-place history rows.

What was changed
Profile subtrack summaries now use placement-bearing history as the source for wins and only fall back to aggregate wins when history has no placement data. The compact Member Stats block now passes stats history into the same aggregation path used by the detail pages.

Any added/updated tests
Added regression coverage for stale nonzero aggregate wins being overridden by placement history, while preserving aggregate wins when legacy history rows do not include placement data.
@jmgasper jmgasper marked this pull request as ready for review July 1, 2026 22:51
@jmgasper jmgasper requested a review from kkartunov as a code owner July 1, 2026 22:51
@jmgasper jmgasper merged commit ba7e581 into dev Jul 1, 2026
7 checks passed
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