Allow Q&A rounds without upvotes and limit upvotes per question
CI / Deploy / test (push) Successful in 57s
CI / Deploy / deploy (push) Skipped

- max_upvotes = 0 disables upvoting: the voting stage is skipped
  (collect -> discuss), questions are discussed in submission order
- new setting max_upvotes_per_question caps a participant's upvotes
  on a single question (0 = no limit besides max_upvotes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-09 08:36:02 +01:00
1 parent 3e44ded107
commit bc86ec2db6
16 files changed
+235 -38

No files matched your search

+3 -2
View File
@@ -211,14 +211,15 @@ $bar = function (float $percent, bool $ok = false): string {
<?php if ($r['questions'] === []) : ?>
<p class="empty"><?= __('Keine Fragen eingereicht.') ?></p>
<?php else : ?>
<?php $withUpvotes = $r['maxUpvotes'] > 0; ?>
<table>
<thead><tr><th class="num">#</th><th><?= __('Frage') ?></th><th class="num"><?= __('Upvotes') ?></th></tr></thead>
<thead><tr><th class="num">#</th><th><?= __('Frage') ?></th><?php if ($withUpvotes) : ?><th class="num"><?= __('Upvotes') ?></th><?php endif; ?></tr></thead>
<tbody>
<?php foreach ($r['questions'] as $i => $question) : ?>
<tr>
<td class="num"><?= $i + 1 ?>.</td>
<td><?= nl2br(h($question['text'])) ?></td>
<td class="num"><?= (int)$question['votes'] ?></td>
<?php if ($withUpvotes) : ?><td class="num"><?= (int)$question['votes'] ?></td><?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
+5 -1
View File
@@ -96,7 +96,11 @@ $hasInternal = array_filter($slides, fn($slide) => $slide->isInteractive() && $s
'collect' => __('Fragen sammeln'),
'vote' => __('Abstimmung läuft'),
'discuss' => __('Fragen werden besprochen'),
][$slide->qaStage()]) ?> · <?= __n('max. {0} Upvote pro Person', 'max. {0} Upvotes pro Person', (int)$slide->setting('max_upvotes'), (int)$slide->setting('max_upvotes')) ?><?= $slide->setting('allow_self_upvote') ? ' · ' . __('auch für eigene Fragen') : '' ?></span>
][$slide->qaStage()]) ?> · <?php if (!$slide->hasQaUpvotes()) : ?><?= __('ohne Upvotes') ?><?php else :
$maxUpvotes = (int)$slide->setting('max_upvotes');
$perQuestion = $slide->qaUpvotesPerQuestion(); ?>
<?= __n('max. {0} Upvote pro Person', 'max. {0} Upvotes pro Person', $maxUpvotes, $maxUpvotes) ?><?= $perQuestion < $maxUpvotes ? ' · ' . __n('{0} pro Frage', '{0} pro Frage', $perQuestion, $perQuestion) : '' ?><?= $slide->setting('allow_self_upvote') ? ' · ' . __('auch für eigene Fragen') : '' ?>
<?php endif; ?></span>
<?php elseif ($slide->isOrder() && !$slide->is_voting_open) : ?>
<span class="muted">· <?= __('Abstimmung geschlossen, aufgelöst') ?></span>
<?php elseif (!$slide->is_voting_open) : ?><span class="muted">· <?= __('Abstimmung geschlossen') ?></span><?php endif; ?>
+18 -9
View File
@@ -173,19 +173,28 @@ $countdown = function (?int $remaining): string {
<label for="qa-question" class="qa-form__label"><?= __('Deine Frage') ?></label>
<textarea id="qa-question" name="question" rows="3" maxlength="500" required
aria-describedby="qa-hint" placeholder="<?= __('Was möchtest du wissen?') ?>"></textarea>
<p class="hint" id="qa-hint"><?= __('Anonym. Du kannst mehrere Fragen stellen. Schau unten, ob deine Frage schon gestellt wurde – dann unterstützt du sie einfach beim Abstimmen, das nach der Sammelphase beginnt.') ?></p>
<p class="hint" id="qa-hint"><?= $qa['maxUpvotes'] > 0
? __('Anonym. Du kannst mehrere Fragen stellen. Schau unten, ob deine Frage schon gestellt wurde – dann unterstützt du sie einfach beim Abstimmen, das nach der Sammelphase beginnt.')
: __('Anonym. Du kannst mehrere Fragen stellen. Schau unten, ob deine Frage schon gestellt wurde.') ?></p>
<?= $this->Form->button(__('Frage einreichen'), ['class' => 'button button--primary button--block']) ?>
<?= $this->Form->end() ?>
<?php else : ?>
<?= $this->Form->hidden('slide_id', ['value' => $slide->id]) ?>
<p class="hint"><?= $qa['stage'] === 'vote'
? __n(
'Du hast eine Stimme: Gib sie mit „+“ der Frage, die dir am wichtigsten ist. Mit „−“ nimmst du sie zurück.',
'Du hast {0} Stimmen: Verteile sie mit „+“ auf die Fragen, die dir wichtig sind – gern auch mehrere auf eine Frage. Mit „−“ nimmst du eine zurück.',
$qa['maxUpvotes'],
$qa['maxUpvotes'],
)
: __('Die Fragen werden jetzt besprochen – die mit den meisten Stimmen zuerst.') ?></p>
<p class="hint"><?php if ($qa['stage'] === 'vote') : ?>
<?php if ($qa['maxUpvotes'] === 1) : ?>
<?= __('Du hast eine Stimme: Gib sie mit „+“ der Frage, die dir am wichtigsten ist. Mit „−“ nimmst du sie zurück.') ?>
<?php elseif ($qa['maxPerQuestion'] === 1) : ?>
<?= __('Du hast {0} Stimmen: Verteile sie mit „+“ auf die Fragen, die dir wichtig sind – jede Frage kann eine Stimme von dir bekommen. Mit „−“ nimmst du sie zurück.', $qa['maxUpvotes']) ?>
<?php elseif ($qa['maxPerQuestion'] < $qa['maxUpvotes']) : ?>
<?= __('Du hast {0} Stimmen: Verteile sie mit „+“ auf die Fragen, die dir wichtig sind – höchstens {1} auf eine Frage. Mit „−“ nimmst du eine zurück.', $qa['maxUpvotes'], $qa['maxPerQuestion']) ?>
<?php else : ?>
<?= __('Du hast {0} Stimmen: Verteile sie mit „+“ auf die Fragen, die dir wichtig sind – gern auch mehrere auf eine Frage. Mit „−“ nimmst du eine zurück.', $qa['maxUpvotes']) ?>
<?php endif; ?>
<?php elseif ($qa['maxUpvotes'] > 0) : ?>
<?= __('Die Fragen werden jetzt besprochen – die mit den meisten Stimmen zuerst.') ?>
<?php else : ?>
<?= __('Die Fragen werden jetzt besprochen – in der Reihenfolge, in der sie eingegangen sind.') ?>
<?php endif; ?></p>
<noscript><p class="muted"><?= __('Zum Abstimmen wird JavaScript benötigt.') ?></p></noscript>
<?php endif; ?>
<p class="qa-message" data-qa-message role="status" aria-live="polite"></p>
+11 -3
View File
@@ -285,12 +285,20 @@ $optionsError = $slide->getError('options_text');
?>
<?= $this->Form->control('settings.max_upvotes', [
'type' => 'select',
'options' => $upvoteOptions,
'options' => [0 => __('keine – ohne Abstimmung')] + $upvoteOptions,
'label' => __('Upvotes (Stimmen) pro Person'),
'value' => $settings['max_upvotes'],
'aria-describedby' => 'qa-upvotes-hint',
]) ?>
<p class="hint" id="qa-upvotes-hint"><?= __('So viele Stimmen hat jede Person beim Abstimmen. Sie lassen sich frei auf Fragen anderer verteilen – mehrere auf eine Frage geben ihr mehr Gewicht.') ?></p>
<p class="hint" id="qa-upvotes-hint"><?= __('So viele Stimmen hat jede Person beim Abstimmen. Sie lassen sich auf Fragen anderer verteilen. Mit „keine“ entfällt die Abstimmung: Nach dem Sammeln werden die Fragen in der Reihenfolge besprochen, in der sie eingegangen sind.') ?></p>
<?= $this->Form->control('settings.max_upvotes_per_question', [
'type' => 'select',
'options' => [0 => __('unbegrenzt (bis alle Stimmen vergeben sind)')] + $upvoteOptions,
'label' => __('Höchstens pro Frage'),
'value' => $settings['max_upvotes_per_question'],
'aria-describedby' => 'qa-per-question-hint',
]) ?>
<p class="hint" id="qa-per-question-hint"><?= __('So viele Stimmen darf eine Person derselben Frage geben. „1 Stimme“ heißt: jede Frage höchstens einmal unterstützen. Mehrere Stimmen auf eine Frage geben ihr mehr Gewicht.') ?></p>
<?= $this->Form->control('settings.allow_self_upvote', [
'type' => 'checkbox',
'label' => __('Stimmen für eigene Fragen erlauben'),
@@ -298,7 +306,7 @@ $optionsError = $slide->getError('options_text');
'aria-describedby' => 'qa-self-upvote-hint',
]) ?>
<p class="hint" id="qa-self-upvote-hint"><?= __('Sinnvoll, wenn ihr Themen priorisiert („Was besprechen wir heute?“). Bei normalen Fragerunden lieber aus: Sonst landen oft die Fragen derjenigen vorn, die alle Stimmen sich selbst geben.') ?></p>
<p class="hint"><?= __('Ablauf in der Präsentation: 1. Fragen sammeln, 2. abstimmen, 3. besprechen – die Frage mit den meisten Upvotes zuerst. Du schaltest die Schritte selbst weiter.') ?></p>
<p class="hint"><?= __('Ablauf in der Präsentation: 1. Fragen sammeln, 2. abstimmen, 3. besprechen – die Frage mit den meisten Upvotes zuerst. Ohne Upvotes entfällt Schritt 2. Du schaltest die Schritte selbst weiter.') ?></p>
<?php endif; ?>
<?php if ($slide->isInteractive() && !$slide->isQuiz() && !$slide->isQa()) : ?>