Reset every slide to the state of a new slide
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:
1 parent
e4622b439e
commit
0eb054ed29
3 files changed
+12
-19
No files matched your search
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user