Add optional comment field to multiple choice slides
CI / Deploy / PHP 8.4 (push) Successful in 1m11s
CI / Deploy / PHP 8.5 (push) Successful in 1m11s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped

Participants can justify their choice; the comment is stored once in the
first response row, rotates on the stage like scale comments and is listed
in the admin area and the PDF export.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-13 09:29:25 +01:00
1 parent 28bfd535f4
commit 61718ed7c6
14 files changed
+330 -29

No files matched your search

+5 -3
View File
@@ -101,7 +101,9 @@ class Slide extends Entity
* @var array<string, array<string, mixed>>
*/
public const DEFAULT_SETTINGS = [
self::TYPE_CHOICE => ['multiple' => false],
// comments: optional comment field (stored in text_value of the participant's first row),
// comments rotate in the presentation like those of a scale
self::TYPE_CHOICE => ['multiple' => false, 'comments' => false],
// allow_downvotes only takes effect together with allow_upvotes
self::TYPE_WORDCLOUD => ['allow_upvotes' => true, 'allow_downvotes' => true],
// private: anonymous feedback, answers only visible in the admin area (never on the stage)
@@ -500,13 +502,13 @@ class Slide extends Entity
}
/**
* Scale with an optional comment field for participants.
* Multiple choice or scale with an optional comment field for participants.
*
* @return bool
*/
public function hasComments(): bool
{
return $this->type === self::TYPE_SCALE && (bool)$this->setting('comments');
return in_array($this->type, [self::TYPE_CHOICE, self::TYPE_SCALE], true) && (bool)$this->setting('comments');
}
/**
+1
View File
@@ -142,6 +142,7 @@ class SlidesTable extends Table
switch ($type) {
case Slide::TYPE_CHOICE:
$settings['multiple'] = filter_var($input['multiple'] ?? false, FILTER_VALIDATE_BOOLEAN);
$settings['comments'] = filter_var($input['comments'] ?? false, FILTER_VALIDATE_BOOLEAN);
break;
case Slide::TYPE_WORDCLOUD:
$settings['allow_upvotes'] = filter_var($input['allow_upvotes'] ?? true, FILTER_VALIDATE_BOOLEAN);