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

+12
View File
@@ -109,6 +109,18 @@ class Poll extends Entity
$this->embed_seen_at = null;
}
/**
* Back to "not started": neither live nor paused. Idempotent.
*
* @return void
*/
public function notStarted(): void
{
$this->current_slide_id = null;
$this->paused_slide_id = null;
$this->embed_seen_at = null;
}
/**
* A slide leaves the presentation (deleted or hidden). If it was live or is the one a pause
* resumes, the poll pauses and resumes with $resumeSlideId instead (null: no slides left =
+12
View File
@@ -172,6 +172,18 @@ class ResponsesTable extends Table
return (int)($row['n'] ?? 0);
}
/**
* @param int $pollId Poll id
* @return bool Whether the poll has Q&A questions entered beforehand
*/
public function hasPrepared(int $pollId): bool
{
return $this->find()
->innerJoinWith('Slides')
->where(['Slides.poll_id' => $pollId, 'Responses.participant_hash' => VoteService::PREPARED_HASH])
->count() > 0;
}
/**
* Number of responding participants per slide of a poll.
*