Skip to content

v0.4.2 — voter-share % for multi-choice polls

Choose a tag to compare

@asm0dey asm0dey released this 18 May 08:59
· 88 commits to main since this release

Highlights

Multi-choice poll percentages now answer "what fraction of the room picked X?" A question with 2 voters and max=3 picks rendered "33% SAP Machine" even when both voters had picked it — the figure was selection-share (count / total selections) rather than voter-share. Audience reading bars as "share of the room" got nonsensical numbers like "33% among 2 voters".

Leader-row percentage label is readable again. The leader row applied color: var(--sp-accent-fg) row-wide, but the bar fill only spans pct% of the row width. The right-anchored percentage label sat outside the bar when pct < 100, so in dark theme the near-black accent-fg landed on the dark row background — illegible.

Fix

  • ResultsPanel denominator switches to voterCount when maxSelections > 1. Single-choice keeps the historical count / total path (the two are equivalent there). Each voter contributes at most 1 to any option's count, so count / voterCount ≤ 1 by construction.
  • Scoped the leader colour override to .sp-rp__label only. The label sits at the left edge (always inside the bar when pct > 0) and keeps the on-accent foreground; the percentage inherits theme --sp-fg and reads against --sp-bg-subtle outside the bar.

Tests

  • New ResultsPanel.test.ts case reproduces the exact 2-voter / 6-selection scenario and asserts SAP Machine renders 100% (not 33%), singletons 50%, unpicked 0%.

Full changelog

v0.4.1...v0.4.2