Add a star rating style to scale slides

Scales can now be shown as stars (1 to n) instead of numbered steps:
participants tap stars, the stage shows the average as partly filled
stars and the distribution as bars from most to fewest stars, and the
evaluation page and PDF export print ratings as stars.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-11 12:46:33 +01:00
1 parent 1ee870d67c
commit c1f9be2eef
14 files changed
+400 -31

No files matched your search

+6 -4
View File
@@ -171,10 +171,12 @@ $bar = function (float $percent, bool $ok = false): string {
<p>
<?= __('Durchschnitt') ?>:
<span class="stat"><?= $r['average'] === null ? '–' : $number((float)$r['average'], 1) ?></span>
<span class="muted"><?= __('auf einer Skala von {0} bis {1}', (int)$r['min'], (int)$r['max']) ?></span>
<span class="muted"><?= !empty($r['stars'])
? __('von {0} Sternen', (int)$r['max'])
: __('auf einer Skala von {0} bis {1}', (int)$r['min'], (int)$r['max']) ?></span>
</p>
<table>
<thead><tr><th><?= __('Wert') ?></th><th class="num"><?= __('Anzahl') ?></th><th class="num"><?= __('Anteil') ?></th><th></th></tr></thead>
<thead><tr><th><?= !empty($r['stars']) ? __('Sterne') : __('Wert') ?></th><th class="num"><?= __('Anzahl') ?></th><th class="num"><?= __('Anteil') ?></th><th></th></tr></thead>
<tbody>
<?php foreach ($r['buckets'] as $i => $bucket) :
$label = match (true) {
@@ -183,7 +185,7 @@ $bar = function (float $percent, bool $ok = false): string {
default => '',
}; ?>
<tr>
<td><?= (int)$bucket['value'] ?><?php if ($label !== '') : ?> <span class="muted">(<?= h($label) ?>)</span><?php endif; ?></td>
<td<?= !empty($r['stars']) ? ' class="stars"' : '' ?>><?= h($slide->ratingText((int)$bucket['value'])) ?><?php if ($label !== '') : ?> <span class="muted">(<?= h($label) ?>)</span><?php endif; ?></td>
<td class="num"><?= (int)$bucket['count'] ?></td>
<td class="num"><?= $number((float)$bucket['percent']) ?> %</td>
<td class="bar"><?= $bar((float)$bucket['percent']) ?></td>
@@ -200,7 +202,7 @@ $bar = function (float $percent, bool $ok = false): string {
<?php foreach ($r['comments'] as $comment) : ?>
<li>
<?= nl2br(h($comment['text'])) ?>
<?php if ($comment['value'] !== null) : ?><span class="muted">(<?= __('Bewertung {0}', (int)$comment['value']) ?>)</span><?php endif; ?>
<?php if ($comment['value'] !== null) : ?><span class="muted">(<?= __('Bewertung {0}', h($slide->ratingText((int)$comment['value']))) ?>)</span><?php endif; ?>
</li>
<?php endforeach; ?>
</ol>