Skip to content

fix(display): group event buckets by app-space track, not histogram - #2933

Merged
jung-thomas merged 2 commits into
DEVfrom
worktree-display-path-buckets
Oct 26, 2026
Merged

jung-thomas merged 2 commits into
DEVfrom
worktree-display-path-buckets

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Summary

The event display-app's content views ("Most Popular Tracks", "Finished by Topic", "Who's on Fire", "Topic Distribution", Activity Ticker) showed the wrong labels — rows like "1 tutorial / 2 tutorials / 3 tutorials" instead of real names.

Root cause: getEventBuckets returned a per-attendee completion histogram, but every display consumer (socket keying, DonutChart, TrendingView, both leaderboards, ticker) is written to render completions grouped by name. Two incompatible groupings shared one buckets array. The earlier date-window fix populated the (mis-shaped) histogram, surfacing the mismatch.

Fix: group buckets by track = CompletionPaths under the event's mission — the same resolution the app-space page uses. No new grouping invented.

event → mission (Events.mission_ID, else Missions.event_ID backlink)
      → CompletionPaths  (each = one track, label = CompletionPaths.name)
      → completions matched via CompletionPathItems (+ GroupPathItems for GROUP items)

Window-scoped to [startDate,endDate]; distinct users per track.

Changes

  • srv/lib/event-path-buckets.js (new) — single source of truth. computePathBuckets() + trackNamesForTutorial() + shared resolveEventMissionId()/buildTrackMap() helpers.
  • srv/event-stream-service.js (anonymous display) — getEventBuckets → computePathBuckets.
  • srv/display-service.js (authed admin) — same fix; it had the identical event_ID-always-NULL bug (returned []).
  • srv/developer-service.js (realtime socket) — live completions now labeled with their track name(s) in the active event's mission (one emit per track), replacing primaryTag keying that never matched bucket names. Completions outside every track emit nothing.

Verification

  • 44 unit tests pass (new event-path-buckets.test.js incl. GROUP-expansion + distinct-user counting; updated event-stream + display-service specs).
  • Probed PROD event 10000002: returns real tracks ("ABAP":2, "Joule Studio":1), resolved via the Missions.event_ID backlink (the event's mission_ID is NULL — the known FK trap, handled).

Test plan

  • Deploy to DEV, load display-app against event 10000002, confirm track-named bars across all views + live increments land in the right bar

release: promote event display date-window fix (DEV \u2192 main)
…histogram

The event display-app's views (Most Popular Tracks, Finished by Topic,
Who's on Fire, Topic Distribution, Activity Ticker) rendered the wrong
labels — "1 tutorial / 2 tutorials…" — because getEventBuckets returned a
per-attendee completion histogram while every consumer (socket, DonutChart,
TrendingView, leaderboards, ticker) expects completions grouped by name.
The prior date-window fix made the (mis-shaped) histogram data appear,
surfacing the long-standing mismatch.

Group buckets by TRACK instead, reusing the SAME resolution the app-space
page uses (no new grouping invented):
  event → mission (Events.mission_ID, else Missions.event_ID backlink)
        → CompletionPaths (each = one track, label = CompletionPaths.name)
        → completions matched to a track via CompletionPathItems, with GROUP
          items expanded through GroupPathItems to child tutorials
Window-scoped to [startDate,endDate]; distinct users per track.

New shared lib srv/lib/event-path-buckets.js is the single source of truth:
- computePathBuckets() — used by BOTH the anonymous EventStreamService AND
  the authed DisplayService getEventBuckets (both previously keyed on the
  always-NULL event_ID → empty results).
- trackNamesForTutorial() — the realtime socket emit now labels each live
  completion with its track name(s) in the active event's mission (one emit
  per matching track), replacing the primaryTag keying that never matched
  the bucket names. Completions outside every track emit nothing.

Verified against PROD event 10000002: returns real tracks ("ABAP":2,
"Joule Studio":1) resolved via the Missions.event_ID backlink.
@jung-thomas
jung-thomas merged commit d01bf7f into DEV Oct 26, 2026
4 of 5 checks passed
@jung-thomas
jung-thomas deleted the worktree-display-path-buckets branch October 26, 2026 17:17
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