Merge pull request 'Reset poll to "not started" and keep prepared Q&A questions' (#75) from feature/reset-not-started into main
CI / Deploy / PHP 8.5 (push) Successful in 1m4s
CI / Deploy / PHP 8.4 (push) Successful in 1m5s
CI / Deploy / test (push) Successful in 2s
CI / Deploy / deploy (push) Successful in 11s

Reviewed-on: #75
This commit was merged in pull request #75.
This commit is contained in:
gnilebein committed 2026-11-13 10:03:49 +01:00
commit 3c66597696
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.
*