Offer reset when slides were touched, not only when answers exist
CI / Deploy / PHP 8.5 (push) Successful in 1m6s
CI / Deploy / PHP 8.4 (push) Successful in 1m7s
CI / Deploy / test (push) Successful in 2s
CI / Deploy / deploy (push) Skipped

The dashboard and per-slide reset buttons only checked for responses, so a
started quiz without votes, a closed slide or a running presentation could
not be reset. Check Slide::isFresh() and Poll::isStarted() as well.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-13 10:26:44 +01:00
1 parent 0eb054ed29
commit 9c6a19f0de
6 files changed
+81 -10

No files matched your search

@@ -149,4 +149,39 @@ class PollResetTest extends TestCase
$this->get("/admin/$token");
$this->assertResponseContains("/admin/$token/reset\"");
}
public function testDashboardOffersResetWithoutAnswersWhenSlidesWereTouched(): void
{
[$poll, $token] = $this->createPoll();
$quiz = $this->createSlide($poll, Slide::TYPE_QUIZ);
$quiz->startFresh();
$this->slidesTable()->saveOrFail($quiz);
$choice = $this->createSlide($poll, Slide::TYPE_CHOICE);
$this->get("/admin/$token");
$this->assertResponseContains('Noch nichts zurückzusetzen');
// Quiz started, nobody answered yet.
$quiz->setVotingOpen(true);
$this->slidesTable()->saveOrFail($quiz);
$this->get("/admin/$token");
$this->assertResponseContains("/admin/$token/reset\"");
$this->assertResponseContains("/admin/$token/slides/{$quiz->id}/reset");
$this->assertResponseNotContains("/admin/$token/slides/{$choice->id}/reset");
// Closed slide.
$quiz->startFresh();
$this->slidesTable()->saveOrFail($quiz);
$choice->is_voting_open = false;
$this->slidesTable()->saveOrFail($choice);
$this->get("/admin/$token");
$this->assertResponseContains("/admin/$token/reset\"");
$this->assertResponseContains("/admin/$token/slides/{$choice->id}/reset");
// Presentation running.
$choice->startFresh();
$this->slidesTable()->saveOrFail($choice);
$this->goLive($poll, $choice);
$this->get("/admin/$token");
$this->assertResponseContains("/admin/$token/reset\"");
}
}