Reset poll to "not started" and keep prepared Q&A questions
CI / Deploy / PHP 8.4 (push) Successful in 1m5s
CI / Deploy / PHP 8.5 (push) Successful in 1m7s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped

Resetting a poll now also clears the live/paused slide so the presentation
starts over. Questions entered beforehand on Q&A slides are kept by default
(only their upvotes are removed); the dashboard offers a checkbox to delete
them too. Resetting a single slide always keeps them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-13 09:52:26 +01:00
1 parent 19320f01c4
commit 97a60290b4
7 files changed
+119 -22

No files matched your search

+8 -4
View File
@@ -59,7 +59,9 @@ class AdminController extends AdminAppController
// Created on first visit, so every slide has its embed URL ready to copy.
$embedKey = $this->Polls->ensureEmbedKey($this->poll);
$this->set(compact('slides', 'responseCounts', 'typeLabels', 'typeDescriptions', 'joinUrl', 'embedKey'));
$hasPrepared = $this->Responses->hasPrepared($this->poll->id);
$this->set(compact('slides', 'responseCounts', 'hasPrepared', 'typeLabels', 'typeDescriptions', 'joinUrl', 'embedKey'));
}
/**
@@ -117,15 +119,17 @@ class AdminController extends AdminAppController
}
/**
* Deletes all responses of all slides; slides, settings and the presentation are kept
* (e.g. to run the poll with another group).
* Deletes all responses of all slides and puts the presentation back to "not started"; slides and settings
* are kept (e.g. to run the poll with another group). Prepared Q&A questions stay unless
* `keep_prepared` is sent as 0.
*
* @return \Cake\Http\Response|null
*/
public function reset(): ?Response
{
$this->request->allowMethod(['post']);
(new ResetService())->poll($this->poll);
$keepPrepared = $this->request->getData('keep_prepared', '1') !== '0';
(new ResetService())->poll($this->poll, $keepPrepared);
$this->Flash->success(__('Alle Antworten wurden gelöscht.'));
return $this->redirect($this->adminUrl());