Reset every slide to the state of a new slide
CI / Deploy / PHP 8.4 (push) Successful in 1m4s
CI / Deploy / PHP 8.5 (push) Successful in 1m7s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped

Resetting answers now reopens closed slides (and hides the solution of
ordering slides) instead of only restarting quiz and Q&A slides.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-13 10:19:17 +01:00
1 parent e4622b439e
commit 0eb054ed29
3 files changed
+12 -19

No files matched your search

+6 -14
View File
@@ -11,7 +11,7 @@ use Cake\ORM\Locator\LocatorAwareTrait;
/**
* Deletes responses of a slide or of the whole poll. Everything else (slides, settings) stays;
* quiz and Q&A slides go back to their start, since their phases make no sense without answers,
* every slide goes back to the state of a new one (Slide::startFresh()),
* and resetting the poll puts the presentation back to "not started".
* Idempotent: resetting twice gives the same result.
*/
@@ -37,8 +37,8 @@ class ResetService
}
/**
* Deletes all responses of a slide. A quiz goes back to "not started"
* (so it can be played again), a Q&A slide back to collecting questions.
* Deletes all responses of a slide and puts it back to the state of a new slide: a quiz is
* "not started" (so it can be played again), a Q&A slide collects questions, all others are open.
*
* Questions the admin entered beforehand (Q&A) are kept unless $keepPrepared is false;
* only the upvotes on them are removed.
@@ -55,17 +55,9 @@ class ResetService
$conditions['participant_hash !='] = VoteService::PREPARED_HASH;
}
$this->Responses->deleteAll($conditions);
if ($slide->isQa()) {
(new QaService())->reset($slide);
return;
}
if ($slide->isQuiz()) {
$slide->is_voting_open = false;
$slide->voting_started_at = null;
$slide->voting_ends_at = null;
$this->Slides->saveOrFail($slide);
}
// Back to the state of a new slide: quiz ready, Q&A collecting, everything else open.
$slide->startFresh();
$this->Slides->saveOrFail($slide);
});
}