Allow resetting the whole poll from the dashboard
CI / Deploy / test (push) Successful in 51s
CI / Deploy / deploy (push) Skipped

Deletes all responses of all slides, puts every slide back to its
initial state and restarts the presentation. Slides, settings, links
and the join code are kept. The per-slide reset shares the logic via
ResetService and now also reopens closed slides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-08 20:30:03 +01:00
1 parent ee593da0e6
commit e1b327899f
8 files changed
+247 -15

No files matched your search

+3 -13
View File
@@ -5,7 +5,7 @@ namespace App\Controller;
use App\Model\Entity\Slide;
use App\Model\Table\SlidesTable;
use App\Service\QaService;
use App\Service\ResetService;
use App\Service\ResultsService;
use App\Service\YouTubeService;
use Cake\Http\Exception\NotFoundException;
@@ -138,7 +138,7 @@ class SlidesController extends AdminAppController
}
/**
* Deletes all responses of a slide.
* Deletes all responses of a slide and puts it back to its initial state.
*
* @param string $id Slide id
* @return \Cake\Http\Response|null
@@ -147,17 +147,7 @@ class SlidesController extends AdminAppController
{
$this->request->allowMethod(['post']);
$slide = $this->loadSlide($id);
$this->Slides->Responses->deleteAll(['slide_id' => $slide->id]);
if ($slide->isQuiz()) {
// Back to "not started" so the quiz can be played again.
$slide->is_voting_open = false;
$slide->voting_started_at = null;
$slide->voting_ends_at = null;
$this->Slides->saveOrFail($slide);
}
if ($slide->isQa()) {
(new QaService())->reset($slide);
}
(new ResetService())->slide($slide);
$this->Flash->success(__('Antworten der Folie „{0}“ wurden gelöscht.', $slide->question));
return $this->redirect($this->adminUrl());