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
@@ -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