Skip to content

Fix pie chart auto-play stopping on no-transfer rounds#618

Closed
skaphan wants to merge 10 commits intoartoonie:mainfrom
skaphan:fix-pie-autoplay
Closed

Fix pie chart auto-play stopping on no-transfer rounds#618
skaphan wants to merge 10 commits intoartoonie:mainfrom
skaphan:fix-pie-autoplay

Conversation

@skaphan
Copy link
Copy Markdown
Contributor

@skaphan skaphan commented Apr 8, 2026

Summary

The pie chart component now skips rounds with no transfers (e.g. a candidate elected with no surplus to redistribute). When this happens during auto-play, the component calls requestRoundChange to advance to the next round, which triggers setStep() on the round player — and setStep() stops playback.

This is a workaround: during auto-play, updateRound() skips the setStep() call so the round player timer keeps running. The dropdown will be briefly out of sync but catches up on the next tick.

Ideally, the round player would respond to the round change by immediately advancing to the next round and continuing the animation, rather than requiring the caller to avoid setStep() during playback.

Test plan

  • Load an election with a no-transfer round (e.g. 2013 Minneapolis Park, round 3)
  • Click Play Animation
  • Verify the animation does not stop at the no-transfer round
  • Verify manual stepping (Next/Back) still works correctly

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6

skaphan added 2 commits April 7, 2026 19:59
Add resumeFrom() to round player so the pie chart can advance the
dropdown during auto-play without stopping playback. When the pie
chart skips a round with no transfers, updateRound() now calls
resumeFrom() instead of setStep() to keep the animation going.

Co-Authored-By: Claude Opus 4.6
Revert round-player.js changes. The simpler approach is to skip
the setStep() call entirely during auto-play so it does not stop
playback. The round player timer catches up on its next tick.

Co-Authored-By: Claude Opus 4.6
@artoonie artoonie mentioned this pull request Apr 8, 2026
skaphan added 8 commits April 8, 2026 16:29
The no-transfer round skipping has been reverted from the pie chart
component, so the workaround in updateRound is no longer needed.

Co-Authored-By: Claude Opus 4.6
Skip no-transfer rounds during pie chart animation by requesting the
controller to advance immediately. Remove firstStepHoldTimeMs workaround
since the first step now fires immediately.

Co-Authored-By: Claude Opus 4.6
The timer delay is for between steps, not before the first one.
Removes the need for the firstStepHoldTimeMs workaround.

Co-Authored-By: Claude Opus 4.6
@artoonie
Copy link
Copy Markdown
Owner

artoonie commented Apr 9, 2026

Does this deprecate firstStepTimeMs? If so, we should remove it.

@skaphan
Copy link
Copy Markdown
Contributor Author

skaphan commented Apr 10, 2026 via email

@artoonie
Copy link
Copy Markdown
Owner

Ah, I see, it is still in use. Great!

@artoonie artoonie mentioned this pull request Apr 10, 2026
@artoonie
Copy link
Copy Markdown
Owner

Merged in #622

@artoonie artoonie closed this Apr 10, 2026
@skaphan skaphan deleted the fix-pie-autoplay branch April 10, 2026 16:51
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.

2 participants