Make rating next to scale comments optional, compact average row
CI / Deploy / test (push) Successful in 50s
CI / Deploy / deploy (push) Skipped

- 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:
gnilebeinandClaude Opus 5.5 committed 2026-11-08 16:49:22 +01:00
1 parent d6166bd9d9
commit 2f5ac533c1
8 files changed
+43 -14

No files matched your search

+1 -1
View File
@@ -175,7 +175,7 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
- **Skala-Kommentare** (Setting `comments`, `Slide::hasComments()`): optionales Feld `comment`, gespeichert als `text_value` - **Skala-Kommentare** (Setting `comments`, `Slide::hasComments()`): optionales Feld `comment`, gespeichert als `text_value`
in derselben Zeile wie `numeric_value` (ohne Setting wird es ignoriert). Öffentliche Skalen liefern im Presenter-/Embed-State in derselben Zeile wie `numeric_value` (ohne Setting wird es ignoriert). Öffentliche Skalen liefern im Presenter-/Embed-State
`results.comments` (Teilnehmende bekommen immer `[]`, `PollStateService::participantResults()`) `results.comments` (Teilnehmende bekommen immer `[]`, `PollStateService::participantResults()`)
(älteste zuerst, je `id`, `text`, `value`); `Comments` in `plenario.js` blättert sie automatisch durch („Kommentar X von N“, (älteste zuerst, je `id`, `text`, `value` – `value` nur mit Setting `comment_ratings`, sonst `null`); `Comments` in `plenario.js` blättert sie automatisch durch („Kommentar X von N“,
vor/zurück/Pause, Zustand übersteht das Neu-Rendern beim Polling). Bei internem Feedback bleibt `comments` leer, vor/zurück/Pause, Zustand übersteht das Neu-Rendern beim Polling). Bei internem Feedback bleibt `comments` leer,
lesbar nur in der Auswertung (`ResultsService::comments()`) und im CSV-Export. lesbar nur in der Auswertung (`ResultsService::comments()`) und im CSV-Export.
+4 -2
View File
@@ -85,9 +85,11 @@ class Slide extends Entity
// private: anonymous feedback, answers only visible in the admin area (never on the stage) // private: anonymous feedback, answers only visible in the admin area (never on the stage)
self::TYPE_OPEN => ['private' => false], self::TYPE_OPEN => ['private' => false],
// private: internal feedback, ratings only visible in the admin area (never on the stage) // 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 => [ 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 => [], self::TYPE_CONTENT => [],
// time_limit in seconds, 0 = no limit (presenter ends the quiz) // time_limit in seconds, 0 = no limit (presenter ends the quiz)
+1
View File
@@ -158,6 +158,7 @@ class SlidesTable extends Table
$settings['max_label'] = mb_substr(trim((string)($input['max_label'] ?? '')), 0, 60); $settings['max_label'] = mb_substr(trim((string)($input['max_label'] ?? '')), 0, 60);
$settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN); $settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN);
$settings['comments'] = filter_var($input['comments'] ?? 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; break;
case Slide::TYPE_QUIZ: case Slide::TYPE_QUIZ:
$limit = (int)($input['time_limit'] ?? $settings['time_limit']); $limit = (int)($input['time_limit'] ?? $settings['time_limit']);
+12 -4
View File
@@ -20,7 +20,8 @@ use Cake\ORM\Locator\LocatorAwareTrait;
* private (anonymous feedback): 'answers' is always empty, texts only via answers() * private (anonymous feedback): 'answers' is always empty, texts only via answers()
* - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null, * - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null,
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool); * '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); * presentation only, emptied for participants in PollStateService);
* private (internal feedback): 'buckets' and 'comments' are always empty and 'average' null, * private (internal feedback): 'buckets' and 'comments' are always empty and 'average' null,
* ratings and comments only via scaleResults() / comments() * ratings and comments only via scaleResults() / comments()
@@ -313,12 +314,19 @@ class ResultsService
protected function scale(Slide $slide): array protected function scale(Slide $slide): array
{ {
if (!$slide->isPrivate()) { if (!$slide->isPrivate()) {
return $this->scaleResults($slide) + [ $showRatings = (bool)$slide->setting('comment_ratings');
'private' => false, $comments = [];
'comments' => $slide->hasComments() ? $this->comments($slide, self::MAX_ANSWERS) : [], 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 [ return [
'buckets' => [], 'buckets' => [],
'average' => null, 'average' => null,
+5
View File
@@ -172,6 +172,11 @@ $optionsError = $slide->getError('options_text');
'checked' => (bool)$settings['comments'], 'checked' => (bool)$settings['comments'],
]) ?> ]) ?>
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden). Bei internem Feedback siehst du sie nur in der Auswertung.') ?></p> <p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden). Bei internem Feedback siehst du sie nur in der Auswertung.') ?></p>
<?= $this->Form->control('settings.comment_ratings', [
'type' => 'checkbox',
'label' => __('Bewertung beim Kommentar in der Präsentation anzeigen'),
'checked' => (bool)$settings['comment_ratings'],
]) ?>
<?= $this->Form->control('settings.private', [ <?= $this->Form->control('settings.private', [
'type' => 'checkbox', 'type' => 'checkbox',
'label' => __('Internes Feedback: Ergebnis nicht öffentlich anzeigen'), 'label' => __('Internes Feedback: Ergebnis nicht öffentlich anzeigen'),
@@ -141,7 +141,17 @@ class ScaleCommentsTest extends TestCase
$this->assertSame(3, $results['participants']); $this->assertSame(3, $results['participants']);
$this->assertEqualsWithDelta(3.0, $results['average'], 0.001); $this->assertEqualsWithDelta(3.0, $results['average'], 0.001);
$this->assertSame(['Sehr <gut>', 'Zu lang'], array_column($results['comments'], 'text')); $this->assertSame(['Sehr <gut>', 'Zu lang'], array_column($results['comments'], 'text'));
$this->assertSame([4, 3], array_column($results['comments'], 'value')); $this->assertSame([null, null], array_column($results['comments'], 'value'));
}
public function testRatingsNextToCommentsAreOptional(): void
{
$this->assertTrue(SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, ['comment_ratings' => '1'])['comment_ratings']);
$this->assertFalse(SlidesTable::sanitizeSettings(Slide::TYPE_SCALE, [])['comment_ratings']);
[, $token] = $this->scaleWithComments(['comment_ratings' => true]);
$this->assertSame([4, 3], array_column($this->presenterResults($token)['comments'], 'value'));
} }
public function testParticipantsNeverSeeComments(): void public function testParticipantsNeverSeeComments(): void
+6 -5
View File
@@ -579,11 +579,12 @@ body.present {
.stage--closed .stage__type::after { content: " · Abstimmung geschlossen"; color: var(--muted); } .stage--closed .stage__type::after { content: " · Abstimmung geschlossen"; color: var(--muted); }
.stage .bar__track { height: 1.1em; } .stage .bar__track { height: 1.1em; }
.stage .columns { height: 34vh; } .stage .columns { height: 34vh; }
.stage .average { padding: 2vh 2.5vw; gap: 2vh 4vw; background: rgba(var(--tint), .06); } .stage .average { padding: 1vh 2vw; gap: 1vh 3vw; margin-bottom: 1.5vh; background: rgba(var(--tint), .06); }
.stage .average__value strong { font-size: clamp(4rem, 9vw, 8rem); } .stage .average__value strong { font-size: clamp(2.6rem, 5vw, 4.5rem); }
.stage .average__of { font-size: clamp(1.6rem, 3vw, 2.8rem); } .stage .average__of { font-size: clamp(1.2rem, 2vw, 1.8rem); }
.stage .average__label, .stage .average__count, .stage .average__ends { font-size: clamp(.9rem, 1.4vw, 1.3rem); } .stage .average__label, .stage .average__count, .stage .average__ends { font-size: clamp(.85rem, 1.2vw, 1.1rem); }
.stage .average__track { height: 1em; box-shadow: none; background: linear-gradient(90deg, var(--surface-2), var(--c1)); } .stage .average__track { height: .7em; box-shadow: none; background: linear-gradient(90deg, var(--surface-2), var(--c1)); }
.stage .average__ends { margin-top: 4px; }
.stage .cloud { font-size: clamp(1.4rem, 2.6vw, 2.6rem); } .stage .cloud { font-size: clamp(1.4rem, 2.6vw, 2.6rem); }
.stage .answers { columns: 340px; } .stage .answers { columns: 340px; }
.stage .quiz-timer { font-size: clamp(3rem, 7vw, 6rem); } .stage .quiz-timer { font-size: clamp(3rem, 7vw, 6rem); }
+3 -1
View File
@@ -386,7 +386,9 @@
node.querySelector('[data-comment-counter]').textContent = node.querySelector('[data-comment-counter]').textContent =
'Kommentar ' + (Comments.index + 1) + ' von ' + Comments.items.length; 'Kommentar ' + (Comments.index + 1) + ' von ' + Comments.items.length;
text.textContent = item.text; text.textContent = item.text;
node.querySelector('[data-comment-value]').textContent = 'Bewertung: ' + item.value; var value = node.querySelector('[data-comment-value]');
value.textContent = item.value === null || item.value === undefined ? '' : 'Bewertung: ' + item.value;
value.hidden = value.textContent === '';
// Only announce changes the viewer triggered, not every automatic rotation. // Only announce changes the viewer triggered, not every automatic rotation.
node.setAttribute('aria-live', Comments.paused ? 'polite' : 'off'); node.setAttribute('aria-live', Comments.paused ? 'polite' : 'off');
text.classList.remove('is-entering'); text.classList.remove('is-entering');