Keep results off participant devices
CI / Deploy / test (push) Successful in 1m9s
CI / Deploy / deploy (push) Skipped

Results belong on the stage. Participants only get results where they
interact with them (word cloud with upvotes) and, once resolved, the
solution of quiz and ordering slides with their own verdict, without
counts or distribution. Removes the per-poll setting
show_results_to_participants (column stays unused).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-08 20:02:36 +01:00
1 parent ecb8f9d31c
commit cfb445123e
14 files changed
+86 -59

No files matched your search

+20 -18
View File
@@ -14,16 +14,14 @@ use Cake\ORM\Locator\LocatorAwareTrait;
* Builds the JSON state polled by the presenter screen (/admin/{token}/state)
* and the participant page (/p/{code}/state).
*
* The participant state never contains results unless the poll allows it and
* the participant has answered (or voting is closed). Exception: word clouds
* with upvotes enabled show the live cloud while voting is open, because
* participants upvote by clicking words in it.
* Results are shown on the presentation screen, not on participants' devices. The participant
* state only contains `results` where participants need them to interact: word clouds with
* upvotes show the live cloud while voting is open (participants upvote by clicking words).
*
* Quiz slides reveal results (and the participant's own correctness) only
* once the quiz is finished – then always, independent of
* `show_results_to_participants`. Timed quizzes are closed lazily here
* when their deadline has passed. Ordering slides work the same way: solution,
* counts and the participant's correctness (`order`) only once voting is closed.
* Quiz slides reveal the solution (and the participant's own correctness) once the quiz is
* finished, without counts or distribution. Timed quizzes are closed lazily here when their
* deadline has passed. Ordering slides work the same way: solution and the participant's
* correctness (`order`) once voting is closed, without counts.
*
* Q&A slides have their own participant view (`qa`, see qaState()), never `results`.
* Private slides (anonymous/internal feedback) never show results to participants,
@@ -163,14 +161,13 @@ class PollStateService
};
$isVotingOpen = $slide?->isVotingOpen() ?? false;
// Results reach the device only where participants act on them (upvoting words)
// or to resolve their own quiz/ordering answer.
$showResults = $slide !== null
&& $slide->isInteractive()
&& $qa === null
&& !$slide->isPrivate()
&& ($quiz !== null || $order !== null
? ($quiz['phase'] ?? null) === Slide::QUIZ_FINISHED || ($order['revealed'] ?? false)
: ($poll->show_results_to_participants && ($hasResponded || !$isVotingOpen))
|| ($words !== null && $words['allowUpvotes'] && $isVotingOpen));
&& (($quiz['phase'] ?? null) === Slide::QUIZ_FINISHED
|| ($order['revealed'] ?? false)
|| ($words !== null && $words['allowUpvotes'] && $isVotingOpen));
return [
'isActive' => $poll->is_active,
@@ -197,7 +194,8 @@ class PollStateService
}
/**
* Results as participants see them: scale comments are for the presentation only.
* Results as participants see them: a resolved quiz/ordering slide only with the
* solution (no counts, no distribution - those are for the stage), a word cloud as is.
*
* @param \App\Model\Entity\Slide $slide Current slide
* @return array<string, mixed>
@@ -205,8 +203,12 @@ class PollStateService
protected function participantResults(Slide $slide): array
{
$results = $this->results->forSlide($slide);
if (isset($results['comments'])) {
$results['comments'] = [];
unset($results['correctCount']);
foreach (['options', 'items'] as $list) {
foreach ($results[$list] ?? [] as $i => $entry) {
unset($entry['count'], $entry['percent'], $entry['placed']);
$results[$list][$i] = $entry;
}
}
return $results;