Make the comment rotation interval configurable
Scale slides get the setting comment_interval (seconds per comment, one of Slide::COMMENT_INTERVALS, default 8). The presenter state carries it as results.commentInterval and the rotating comments use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cfb445123e
commit
2301f91457
7 files changed
+66
-5
No files matched your search
@@ -55,6 +55,13 @@ class Slide extends Entity
|
||||
*/
|
||||
public const QUIZ_TIME_LIMITS = [0, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300];
|
||||
|
||||
/**
|
||||
* Selectable seconds per comment when the comments of a scale rotate in the presentation.
|
||||
*
|
||||
* @var list<int>
|
||||
*/
|
||||
public const COMMENT_INTERVALS = [3, 5, 8, 10, 15, 20, 30, 45, 60];
|
||||
|
||||
/**
|
||||
* Q&A stages, see qaStage(): participants submit questions, then upvote
|
||||
* them, then the presenter discusses them one by one (most upvoted first).
|
||||
@@ -87,9 +94,10 @@ class Slide extends Entity
|
||||
// private: internal feedback, ratings only visible in the admin area (never on the stage)
|
||||
// comments: optional comment field, comments rotate in the presentation (unless private)
|
||||
// comment_ratings: show the rating next to each comment in the presentation
|
||||
// comment_interval: seconds per comment while they rotate (one of COMMENT_INTERVALS)
|
||||
self::TYPE_SCALE => [
|
||||
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false,
|
||||
'comments' => false, 'comment_ratings' => false,
|
||||
'comments' => false, 'comment_ratings' => false, 'comment_interval' => 8,
|
||||
],
|
||||
self::TYPE_CONTENT => [],
|
||||
// time_limit in seconds, 0 = no limit (presenter ends the quiz)
|
||||
|
||||
@@ -159,6 +159,10 @@ class SlidesTable extends Table
|
||||
$settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$settings['comments'] = filter_var($input['comments'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$settings['comment_ratings'] = filter_var($input['comment_ratings'] ?? false, FILTER_VALIDATE_BOOLEAN);
|
||||
$interval = (int)($input['comment_interval'] ?? $settings['comment_interval']);
|
||||
if (in_array($interval, Slide::COMMENT_INTERVALS, true)) {
|
||||
$settings['comment_interval'] = $interval;
|
||||
}
|
||||
break;
|
||||
case Slide::TYPE_QUIZ:
|
||||
$limit = (int)($input['time_limit'] ?? $settings['time_limit']);
|
||||
|
||||
@@ -22,6 +22,7 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
||||
* 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else [];
|
||||
* 'value' is null unless the setting comment_ratings is on;
|
||||
* presentation only, emptied for participants in PollStateService);
|
||||
* 'commentInterval' => int seconds per comment while they rotate;
|
||||
* open/scale with 'private' (anonymous/internal feedback): contents are included for the
|
||||
* presenter/embed, which start with the results hidden and may show them on demand;
|
||||
* participants never get results of these slides, the public PDF strips them (withoutContents())
|
||||
@@ -322,7 +323,11 @@ class ResultsService
|
||||
];
|
||||
}
|
||||
|
||||
return $this->scaleResults($slide) + ['private' => $slide->isPrivate(), 'comments' => $comments];
|
||||
return $this->scaleResults($slide) + [
|
||||
'private' => $slide->isPrivate(),
|
||||
'comments' => $comments,
|
||||
'commentInterval' => (int)$slide->setting('comment_interval'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user