Make rating next to scale comments optional, compact average row
- New scale setting comment_ratings: the rating is only shown next to a comment in the presentation (and sent in the state) when enabled. - Smaller average figure and gauge on the stage so the chart and the comments get more room. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d6166bd9d9
commit
2f5ac533c1
8 files changed
+44
-15
No files matched your search
@@ -85,9 +85,11 @@ class Slide extends Entity
|
||||
// private: anonymous feedback, answers only visible in the admin area (never on the stage)
|
||||
self::TYPE_OPEN => ['private' => false],
|
||||
// private: internal feedback, ratings only visible in the admin area (never on the stage)
|
||||
// comments: optional comment field, comments rotate on the results (unless private)
|
||||
// comments: optional comment field, comments rotate in the presentation (unless private)
|
||||
// comment_ratings: show the rating next to each comment in the presentation
|
||||
self::TYPE_SCALE => [
|
||||
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false, 'comments' => false,
|
||||
'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false,
|
||||
'comments' => false, 'comment_ratings' => false,
|
||||
],
|
||||
self::TYPE_CONTENT => [],
|
||||
// time_limit in seconds, 0 = no limit (presenter ends the quiz)
|
||||
|
||||
@@ -158,6 +158,7 @@ class SlidesTable extends Table
|
||||
$settings['max_label'] = mb_substr(trim((string)($input['max_label'] ?? '')), 0, 60);
|
||||
$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);
|
||||
break;
|
||||
case Slide::TYPE_QUIZ:
|
||||
$limit = (int)($input['time_limit'] ?? $settings['time_limit']);
|
||||
|
||||
@@ -20,7 +20,8 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
||||
* private (anonymous feedback): 'answers' is always empty, texts only via answers()
|
||||
* - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null,
|
||||
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool);
|
||||
* 'comments' => [['id', 'text', 'value']] oldest first (only with the comment field, else [];
|
||||
* '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);
|
||||
* private (internal feedback): 'buckets' and 'comments' are always empty and 'average' null,
|
||||
* ratings and comments only via scaleResults() / comments()
|
||||
@@ -313,10 +314,17 @@ class ResultsService
|
||||
protected function scale(Slide $slide): array
|
||||
{
|
||||
if (!$slide->isPrivate()) {
|
||||
return $this->scaleResults($slide) + [
|
||||
'private' => false,
|
||||
'comments' => $slide->hasComments() ? $this->comments($slide, self::MAX_ANSWERS) : [],
|
||||
];
|
||||
$showRatings = (bool)$slide->setting('comment_ratings');
|
||||
$comments = [];
|
||||
foreach ($slide->hasComments() ? $this->comments($slide, self::MAX_ANSWERS) : [] as $comment) {
|
||||
$comments[] = [
|
||||
'id' => $comment['id'],
|
||||
'text' => $comment['text'],
|
||||
'value' => $showRatings ? $comment['value'] : null,
|
||||
];
|
||||
}
|
||||
|
||||
return $this->scaleResults($slide) + ['private' => false, 'comments' => $comments];
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
Reference in new issue
Block a user