Make Q&A upvote budget a share of the questions
The fixed number of votes per person does not fit varying question counts. The budget is now `upvote_share` percent of the questions (rounded up, at least one), so it grows with the number of questions. A migration converts existing Q&A slides (no voting stays off, others get 25 %). On the stage the voting step no longer lists the questions but points participants to their devices. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3762b880cb
commit
575fb8649d
14 files changed
+170
-75
No files matched your search
@@ -158,15 +158,17 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
|
|||||||
der Presenter schaltet manuell weiter (V bzw. Stepper, auch zurück). `collect`: Fragen einreichen (max.
|
der Presenter schaltet manuell weiter (V bzw. Stepper, auch zurück). `collect`: Fragen einreichen (max.
|
||||||
`VoteService::MAX_QA_QUESTIONS` pro Person, gleiche Frage nur einmal pro Folie), Teilnehmende sehen alle bisherigen Fragen
|
`VoteService::MAX_QA_QUESTIONS` pro Person, gleiche Frage nur einmal pro Folie), Teilnehmende sehen alle bisherigen Fragen
|
||||||
(gegen Dubletten, eigene markiert), aber noch keine Upvotes.
|
(gegen Dubletten, eigene markiert), aber noch keine Upvotes.
|
||||||
`vote`: Upvotes auf fremde Fragen, Budget = Setting `max_upvotes` pro Person, frei verteilbar (auch mehrere auf eine Frage,
|
`vote`: Upvotes auf fremde Fragen, Budget pro Person = Anteil der Fragen (Setting `upvote_share` in Prozent, `Slide::QA_UPVOTE_SHARES`, aufgerundet, mindestens 1:
|
||||||
|
`Slide::qaBudget(Anzahl Fragen)`; im State/JSON `maxUpvotes`), wächst also mit der Fragenzahl, frei verteilbar (auch mehrere auf eine Frage,
|
||||||
je Upvote eine Zeile), `vote=remove` nimmt eine Stimme der Frage zurück; im State `qa.upvoted` = {Frage-id: eigene Stimmen}.
|
je Upvote eine Zeile), `vote=remove` nimmt eine Stimme der Frage zurück; im State `qa.upvoted` = {Frage-id: eigene Stimmen}.
|
||||||
Setting `max_upvotes_per_question` begrenzt die eigenen Stimmen je Frage (0 = nur durch `max_upvotes` begrenzt,
|
Setting `max_upvotes_per_question` begrenzt die eigenen Stimmen je Frage (0 = nur durch das Budget begrenzt,
|
||||||
effektiv `Slide::qaUpvotesPerQuestion()`, State `maxPerQuestion`). `max_upvotes = 0` = ohne Upvotes: es gibt keine Phase `vote`
|
effektiv `Slide::qaUpvotesPerQuestion($budget)`, State `maxPerQuestion`). `upvote_share = 0` = ohne Upvotes: es gibt keine Phase `vote`
|
||||||
(`Slide::qaStages()` = collect → discuss, im Presenter-JSON `results.stages`), besprochen wird in Eingangsreihenfolge;
|
(`Slide::qaStages()` = collect → discuss, im Presenter-JSON `results.stages`), besprochen wird in Eingangsreihenfolge;
|
||||||
wird es während `vote` auf 0 gesetzt, springt `SlidesController::saveSlide()` nach `discuss`.
|
wird es während `vote` auf 0 gesetzt, springt `SlidesController::saveSlide()` nach `discuss`.
|
||||||
Setting `allow_self_upvote` (Standard aus, für Themen-Priorisierung) erlaubt Stimmen auf eigene Fragen aus demselben Budget
|
Setting `allow_self_upvote` (Standard aus, für Themen-Priorisierung) erlaubt Stimmen auf eigene Fragen aus demselben Budget
|
||||||
(State `qa.allowSelfUpvote`); bewusst aus, weil anonym sonst Selbstvermarktung die Rangfolge bestimmt;
|
(State `qa.allowSelfUpvote`); bewusst aus, weil anonym sonst Selbstvermarktung die Rangfolge bestimmt;
|
||||||
Teilnehmende sehen alle Fragen in Eingangsreihenfolge **ohne** Zählung; auch die Bühne (Presenter/Embed, PDF) bekommt in `vote`
|
Teilnehmende sehen alle Fragen in Eingangsreihenfolge **ohne** Zählung; die Bühne (Presenter/Embed) zeigt in `vote` keine Fragen,
|
||||||
|
sondern nur den Hinweis „Schau auf dein Gerät und stimme ab“ mit Fragenzahl, Budget und vergebener Gesamtsumme (`Results.qa`); auch sonst gibt es dort
|
||||||
keine Zählungen je Frage und keine Rangfolge (`ResultsService::qa()`, nur die Summe `upvotes`), damit niemand beeinflusst wird. `discuss`: Abstimmung zu, Fragen nach Upvotes
|
keine Zählungen je Frage und keine Rangfolge (`ResultsService::qa()`, nur die Summe `upvotes`), damit niemand beeinflusst wird. `discuss`: Abstimmung zu, Fragen nach Upvotes
|
||||||
sortiert (Gleichstand: älteste zuerst), `focus_response_id` = aktuelle Frage. In `discuss` blättern next/prev
|
sortiert (Gleichstand: älteste zuerst), `focus_response_id` = aktuelle Frage. In `discuss` blättern next/prev
|
||||||
(→/←, Klicker) zuerst durch die Fragen, erst danach durch die Folien. Fokuswechsel per `updateAll` ohne `modified`,
|
(→/←, Klicker) zuerst durch die Fragen, erst danach durch die Folien. Fokuswechsel per `updateAll` ohne `modified`,
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Migrations\BaseMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Q&A slides: the fixed number of upvotes per person (`max_upvotes`) becomes a share of the
|
||||||
|
* questions (`upvote_share`, percent). "No upvotes" stays off, every other value becomes the default 25 %.
|
||||||
|
*/
|
||||||
|
class ConvertQaUpvotesToShare extends BaseMigration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$rows = $this->fetchAll("SELECT id, settings FROM slides WHERE type = 'qa'");
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$settings = json_decode((string)$row['settings'], true);
|
||||||
|
if (!is_array($settings) || !array_key_exists('max_upvotes', $settings)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$settings['upvote_share'] = (int)$settings['max_upvotes'] === 0 ? 0 : 25;
|
||||||
|
unset($settings['max_upvotes']);
|
||||||
|
$this->getAdapter()->execute(
|
||||||
|
'UPDATE slides SET settings = ? WHERE id = ?',
|
||||||
|
[json_encode($settings, JSON_UNESCAPED_UNICODE), $row['id']],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
-10
@@ -84,10 +84,17 @@ class Slide extends Entity
|
|||||||
public const QA_STAGES = [self::QA_COLLECT, self::QA_VOTE, self::QA_DISCUSS];
|
public const QA_STAGES = [self::QA_COLLECT, self::QA_VOTE, self::QA_DISCUSS];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Highest selectable number of upvotes per participant on a Q&A slide.
|
* Highest selectable number of upvotes one participant may give a single question.
|
||||||
*/
|
*/
|
||||||
public const QA_MAX_UPVOTES = 10;
|
public const QA_MAX_UPVOTES = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selectable shares (percent of the questions) that make up each participant's upvote budget.
|
||||||
|
*
|
||||||
|
* @var list<int>
|
||||||
|
*/
|
||||||
|
public const QA_UPVOTE_SHARES = [10, 20, 25, 33, 50];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default settings per type. Unknown keys are dropped on save.
|
* Default settings per type. Unknown keys are dropped on save.
|
||||||
*
|
*
|
||||||
@@ -117,10 +124,11 @@ class Slide extends Entity
|
|||||||
self::TYPE_QUIZ => ['time_limit' => 30],
|
self::TYPE_QUIZ => ['time_limit' => 30],
|
||||||
// url as entered, video_id parsed from it, start in seconds
|
// url as entered, video_id parsed from it, start in seconds
|
||||||
self::TYPE_YOUTUBE => ['url' => '', 'video_id' => '', 'start' => 0, 'autoplay' => false],
|
self::TYPE_YOUTUBE => ['url' => '', 'video_id' => '', 'start' => 0, 'autoplay' => false],
|
||||||
// max_upvotes: upvotes per participant in the voting stage (0..QA_MAX_UPVOTES, 0 = no voting stage);
|
// upvote_share: percent of the questions each participant may upvote in the voting stage, so the
|
||||||
// max_upvotes_per_question: own upvotes per question (0 = no limit besides max_upvotes);
|
// budget grows with the number of questions (qaBudget(); 0 = no voting stage, else QA_UPVOTE_SHARES);
|
||||||
|
// max_upvotes_per_question: own upvotes per question (0 = no limit besides the budget);
|
||||||
// allow_self_upvote: upvotes on own questions (for prioritizing topics, off by default)
|
// allow_self_upvote: upvotes on own questions (for prioritizing topics, off by default)
|
||||||
self::TYPE_QA => ['max_upvotes' => 3, 'max_upvotes_per_question' => 0, 'allow_self_upvote' => false],
|
self::TYPE_QA => ['upvote_share' => 25, 'max_upvotes_per_question' => 0, 'allow_self_upvote' => false],
|
||||||
// The correct order is the order of the slide_options (position), revealed when voting closes.
|
// The correct order is the order of the slide_options (position), revealed when voting closes.
|
||||||
self::TYPE_ORDER => [],
|
self::TYPE_ORDER => [],
|
||||||
];
|
];
|
||||||
@@ -331,13 +339,13 @@ class Slide extends Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether a Q&A slide has a voting stage (setting `max_upvotes` > 0).
|
* Whether a Q&A slide has a voting stage (setting `upvote_share` > 0).
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasQaUpvotes(): bool
|
public function hasQaUpvotes(): bool
|
||||||
{
|
{
|
||||||
return (int)$this->setting('max_upvotes') > 0;
|
return (int)$this->setting('upvote_share') > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -351,16 +359,32 @@ class Slide extends Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upvotes one participant may give a single Q&A question (never more than `max_upvotes`).
|
* Upvotes each participant gets in the voting stage: `upvote_share` percent of the questions,
|
||||||
|
* rounded up and at least one (0 without questions or without a voting stage).
|
||||||
*
|
*
|
||||||
|
* @param int $questionCount Number of questions on the slide
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function qaUpvotesPerQuestion(): int
|
public function qaBudget(int $questionCount): int
|
||||||
|
{
|
||||||
|
if ($questionCount <= 0 || !$this->hasQaUpvotes()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return max(1, (int)ceil($questionCount * (int)$this->setting('upvote_share') / 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upvotes one participant may give a single Q&A question (never more than the budget).
|
||||||
|
*
|
||||||
|
* @param int $budget Upvotes per participant, see qaBudget()
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function qaUpvotesPerQuestion(int $budget): int
|
||||||
{
|
{
|
||||||
$max = (int)$this->setting('max_upvotes');
|
|
||||||
$perQuestion = (int)$this->setting('max_upvotes_per_question');
|
$perQuestion = (int)$this->setting('max_upvotes_per_question');
|
||||||
|
|
||||||
return $perQuestion > 0 ? min($perQuestion, $max) : $max;
|
return $perQuestion > 0 ? min($perQuestion, $budget) : $budget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -173,9 +173,11 @@ class SlidesTable extends Table
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Slide::TYPE_QA:
|
case Slide::TYPE_QA:
|
||||||
$max = (int)($input['max_upvotes'] ?? $settings['max_upvotes']);
|
$share = (int)($input['upvote_share'] ?? $settings['upvote_share']);
|
||||||
// 0 = no upvotes (no voting stage)
|
// 0 = no upvotes (no voting stage)
|
||||||
$settings['max_upvotes'] = max(0, min(Slide::QA_MAX_UPVOTES, $max));
|
$settings['upvote_share'] = $share === 0 || in_array($share, Slide::QA_UPVOTE_SHARES, true)
|
||||||
|
? $share
|
||||||
|
: Slide::DEFAULT_SETTINGS[Slide::TYPE_QA]['upvote_share'];
|
||||||
$perQuestion = (int)($input['max_upvotes_per_question'] ?? $settings['max_upvotes_per_question']);
|
$perQuestion = (int)($input['max_upvotes_per_question'] ?? $settings['max_upvotes_per_question']);
|
||||||
// 0 = no limit per question
|
// 0 = no limit per question
|
||||||
$settings['max_upvotes_per_question'] = max(0, min(Slide::QA_MAX_UPVOTES, $perQuestion));
|
$settings['max_upvotes_per_question'] = max(0, min(Slide::QA_MAX_UPVOTES, $perQuestion));
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ class PollStateService
|
|||||||
* - discuss: all questions ranked with upvotes, `focusId` = question being discussed
|
* - discuss: all questions ranked with upvotes, `focusId` = question being discussed
|
||||||
* `upvoted` = own upvotes per question id (several per question are allowed),
|
* `upvoted` = own upvotes per question id (several per question are allowed),
|
||||||
* `allowSelfUpvote` = own questions may be upvoted too (setting `allow_self_upvote`).
|
* `allowSelfUpvote` = own questions may be upvoted too (setting `allow_self_upvote`).
|
||||||
* `maxUpvotes` = 0: no voting stage; `maxPerQuestion` = own upvotes allowed per question.
|
* `maxUpvotes` = upvote budget of the participant (share of the questions), 0: no voting stage; `maxPerQuestion` = own upvotes allowed per question.
|
||||||
*
|
*
|
||||||
* @param \App\Model\Entity\Slide $slide Q&A slide
|
* @param \App\Model\Entity\Slide $slide Q&A slide
|
||||||
* @param string $participantHash Participant hash
|
* @param string $participantHash Participant hash
|
||||||
@@ -294,8 +294,8 @@ class PollStateService
|
|||||||
{
|
{
|
||||||
$stage = $slide->qaStage();
|
$stage = $slide->qaStage();
|
||||||
$own = $this->Responses->qaVotesOf($slide->id, $participantHash);
|
$own = $this->Responses->qaVotesOf($slide->id, $participantHash);
|
||||||
$max = (int)$slide->setting('max_upvotes');
|
|
||||||
$questions = (new QaService())->rankedQuestions($slide);
|
$questions = (new QaService())->rankedQuestions($slide);
|
||||||
|
$max = $slide->qaBudget(count($questions));
|
||||||
if ($stage === Slide::QA_DISCUSS) {
|
if ($stage === Slide::QA_DISCUSS) {
|
||||||
$focusId = in_array($slide->focus_response_id, array_column($questions, 'id'), true)
|
$focusId = in_array($slide->focus_response_id, array_column($questions, 'id'), true)
|
||||||
? $slide->focus_response_id
|
? $slide->focus_response_id
|
||||||
@@ -309,7 +309,7 @@ class PollStateService
|
|||||||
return [
|
return [
|
||||||
'stage' => $stage,
|
'stage' => $stage,
|
||||||
'maxUpvotes' => $max,
|
'maxUpvotes' => $max,
|
||||||
'maxPerQuestion' => $slide->qaUpvotesPerQuestion(),
|
'maxPerQuestion' => $slide->qaUpvotesPerQuestion($max),
|
||||||
'votesLeft' => max(0, $max - count($own['upvotes'])),
|
'votesLeft' => max(0, $max - count($own['upvotes'])),
|
||||||
'allowSelfUpvote' => (bool)$slide->setting('allow_self_upvote'),
|
'allowSelfUpvote' => (bool)$slide->setting('allow_self_upvote'),
|
||||||
'mine' => $own['questions'],
|
'mine' => $own['questions'],
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use InvalidArgumentException;
|
|||||||
* Stages (Slide::qaStage()):
|
* Stages (Slide::qaStage()):
|
||||||
* - collect: participants submit questions (voting open)
|
* - collect: participants submit questions (voting open)
|
||||||
* - vote: participants upvote questions of others (own ones with `allow_self_upvote`),
|
* - vote: participants upvote questions of others (own ones with `allow_self_upvote`),
|
||||||
* at most `max_upvotes` each and `max_upvotes_per_question` per question (voting open).
|
* a budget of `upvote_share` percent of the questions each and `max_upvotes_per_question` per question (voting open).
|
||||||
* Skipped with `max_upvotes` = 0 (Slide::qaStages()).
|
* Skipped with `upvote_share` = 0 (Slide::qaStages()).
|
||||||
* - discuss: voting closed; the presenter steps through the questions, most upvoted
|
* - discuss: voting closed; the presenter steps through the questions, most upvoted
|
||||||
* first (`slides.focus_response_id` = question on screen)
|
* first (`slides.focus_response_id` = question on screen)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ class ResultsService
|
|||||||
{
|
{
|
||||||
$questions = (new QaService())->rankedQuestions($slide);
|
$questions = (new QaService())->rankedQuestions($slide);
|
||||||
$upvotes = array_sum(array_column($questions, 'votes'));
|
$upvotes = array_sum(array_column($questions, 'votes'));
|
||||||
|
$budget = $slide->qaBudget(count($questions));
|
||||||
if ($slide->qaStage() === Slide::QA_VOTE) {
|
if ($slide->qaStage() === Slide::QA_VOTE) {
|
||||||
// A live ranking on the stage would sway the vote: submission order, no counts until voting ends.
|
// A live ranking on the stage would sway the vote: submission order, no counts until voting ends.
|
||||||
usort($questions, fn($a, $b) => $a['id'] <=> $b['id']);
|
usort($questions, fn($a, $b) => $a['id'] <=> $b['id']);
|
||||||
@@ -232,8 +233,8 @@ class ResultsService
|
|||||||
return [
|
return [
|
||||||
'stage' => $slide->qaStage(),
|
'stage' => $slide->qaStage(),
|
||||||
'stages' => $slide->qaStages(),
|
'stages' => $slide->qaStages(),
|
||||||
'maxUpvotes' => (int)$slide->setting('max_upvotes'),
|
'maxUpvotes' => $budget,
|
||||||
'maxPerQuestion' => $slide->qaUpvotesPerQuestion(),
|
'maxPerQuestion' => $slide->qaUpvotesPerQuestion($budget),
|
||||||
'upvotes' => $upvotes,
|
'upvotes' => $upvotes,
|
||||||
'questions' => $questions,
|
'questions' => $questions,
|
||||||
'focusId' => $focusIndex === null ? null : $slide->focus_response_id,
|
'focusId' => $focusIndex === null ? null : $slide->focus_response_id,
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ use Cake\Utility\Security;
|
|||||||
* at most MAX_QA_QUESTIONS per participant, the same question (case-insensitive)
|
* at most MAX_QA_QUESTIONS per participant, the same question (case-insensitive)
|
||||||
* only once per slide. `vote=up|remove` + `question_id` only while voting: upvote
|
* only once per slide. `vote=up|remove` + `question_id` only while voting: upvote
|
||||||
* questions of others (own ones too with setting `allow_self_upvote`), at most
|
* questions of others (own ones too with setting `allow_self_upvote`), at most
|
||||||
* `max_upvotes` in total, freely distributed (several on one question are allowed,
|
* a budget of `upvote_share` percent of the questions in total, freely distributed (several on one question are allowed,
|
||||||
* at most `max_upvotes_per_question` if set; `max_upvotes` = 0 means no voting stage);
|
* at most `max_upvotes_per_question` if set; `upvote_share` = 0 means no voting stage);
|
||||||
* `remove` withdraws one own upvote of the question. `vote=edit|delete` + `question_id`
|
* `remove` withdraws one own upvote of the question. `vote=edit|delete` + `question_id`
|
||||||
* changes or deletes an own question, only while collecting (see editQuestion()).
|
* changes or deletes an own question, only while collecting (see editQuestion()).
|
||||||
* - ordering: `order` = all option ids, each exactly once, in the participant's order.
|
* - ordering: `order` = all option ids, each exactly once, in the participant's order.
|
||||||
@@ -404,8 +404,8 @@ class VoteService
|
|||||||
}
|
}
|
||||||
// Several upvotes on the same question are allowed (push important questions),
|
// Several upvotes on the same question are allowed (push important questions),
|
||||||
// up to the limit per question.
|
// up to the limit per question.
|
||||||
$max = (int)$slide->setting('max_upvotes');
|
$max = $slide->qaBudget($this->Responses->questionsOf($slide->id)->count());
|
||||||
$perQuestion = $slide->qaUpvotesPerQuestion();
|
$perQuestion = $slide->qaUpvotesPerQuestion($max);
|
||||||
if ($perQuestion < $max && count(array_keys($own['upvotes'], $id, true)) >= $perQuestion) {
|
if ($perQuestion < $max && count(array_keys($own['upvotes'], $id, true)) >= $perQuestion) {
|
||||||
throw new VoteException(__n(
|
throw new VoteException(__n(
|
||||||
'Du kannst jeder Frage nur eine Stimme geben.',
|
'Du kannst jeder Frage nur eine Stimme geben.',
|
||||||
|
|||||||
@@ -99,9 +99,8 @@ $hasInternal = array_filter($slides, fn($slide) => !$slide->is_hidden && $slide-
|
|||||||
'vote' => __('Abstimmung läuft'),
|
'vote' => __('Abstimmung läuft'),
|
||||||
'discuss' => __('Fragen werden besprochen'),
|
'discuss' => __('Fragen werden besprochen'),
|
||||||
][$slide->qaStage()]) ?> · <?php if (!$slide->hasQaUpvotes()) : ?><?= __('ohne Upvotes') ?><?php else :
|
][$slide->qaStage()]) ?> · <?php if (!$slide->hasQaUpvotes()) : ?><?= __('ohne Upvotes') ?><?php else :
|
||||||
$maxUpvotes = (int)$slide->setting('max_upvotes');
|
$perQuestion = (int)$slide->setting('max_upvotes_per_question'); ?>
|
||||||
$perQuestion = $slide->qaUpvotesPerQuestion(); ?>
|
<?= __('Stimmen für {0} % der Fragen pro Person', (int)$slide->setting('upvote_share')) ?><?= $perQuestion > 0 ? ' · ' . __n('{0} pro Frage', '{0} pro Frage', $perQuestion, $perQuestion) : '' ?><?= $slide->setting('allow_self_upvote') ? ' · ' . __('auch für eigene Fragen') : '' ?>
|
||||||
<?= __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 endif; ?></span>
|
||||||
<?php elseif ($slide->isOrder() && !$slide->is_voting_open) : ?>
|
<?php elseif ($slide->isOrder() && !$slide->is_voting_open) : ?>
|
||||||
<span class="muted">· <?= __('Abstimmung geschlossen, aufgelöst') ?></span>
|
<span class="muted">· <?= __('Abstimmung geschlossen, aufgelöst') ?></span>
|
||||||
|
|||||||
@@ -301,14 +301,20 @@ $optionsError = $slide->getError('options_text');
|
|||||||
$upvoteOptions[$n] = __n('{0} Stimme', '{0} Stimmen', $n, $n);
|
$upvoteOptions[$n] = __n('{0} Stimme', '{0} Stimmen', $n, $n);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?= $this->Form->control('settings.max_upvotes', [
|
<?php
|
||||||
|
$shareOptions = [];
|
||||||
|
foreach (\App\Model\Entity\Slide::QA_UPVOTE_SHARES as $share) {
|
||||||
|
$shareOptions[$share] = __('{0} % der Fragen', $share);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?= $this->Form->control('settings.upvote_share', [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'options' => [0 => __('keine – ohne Abstimmung')] + $upvoteOptions,
|
'options' => [0 => __('keine – ohne Abstimmung')] + $shareOptions,
|
||||||
'label' => __('Upvotes (Stimmen) pro Person'),
|
'label' => __('Stimmen pro Person'),
|
||||||
'value' => $settings['max_upvotes'],
|
'value' => $settings['upvote_share'],
|
||||||
'aria-describedby' => 'qa-upvotes-hint',
|
'aria-describedby' => 'qa-upvotes-hint',
|
||||||
]) ?>
|
]) ?>
|
||||||
<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>
|
<p class="hint" id="qa-upvotes-hint"><?= __('Die Zahl der Stimmen hängt von der Zahl der Fragen ab: Bei 25 % und 12 Fragen hat jede Person 3 Stimmen (immer mindestens eine). 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', [
|
<?= $this->Form->control('settings.max_upvotes_per_question', [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'options' => [0 => __('unbegrenzt (bis alle Stimmen vergeben sind)')] + $upvoteOptions,
|
'options' => [0 => __('unbegrenzt (bis alle Stimmen vergeben sind)')] + $upvoteOptions,
|
||||||
|
|||||||
@@ -61,29 +61,29 @@ class QaSlideTest extends TestCase
|
|||||||
[$poll, $token] = $this->createPoll();
|
[$poll, $token] = $this->createPoll();
|
||||||
$this->get("/admin/$token/slides/add?type=qa");
|
$this->get("/admin/$token/slides/add?type=qa");
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
$this->assertResponseContains('Upvotes (Stimmen) pro Person');
|
$this->assertResponseContains('Stimmen pro Person');
|
||||||
$this->assertResponseNotContains('Abstimmung geöffnet');
|
$this->assertResponseNotContains('Abstimmung geöffnet');
|
||||||
|
|
||||||
$this->post("/admin/$token/slides/add?type=qa", [
|
$this->post("/admin/$token/slides/add?type=qa", [
|
||||||
'type' => 'qa',
|
'type' => 'qa',
|
||||||
'question' => 'Eure Fragen an den Vorstand',
|
'question' => 'Eure Fragen an den Vorstand',
|
||||||
'settings' => ['max_upvotes' => '5'],
|
'settings' => ['upvote_share' => '25'],
|
||||||
]);
|
]);
|
||||||
$this->assertRedirect();
|
$this->assertRedirect();
|
||||||
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->firstOrFail();
|
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->firstOrFail();
|
||||||
$this->assertSame([Slide::TYPE_QA, 5, Slide::QA_COLLECT, true], [
|
$this->assertSame([Slide::TYPE_QA, 25, Slide::QA_COLLECT, true], [
|
||||||
$slide->type, $slide->setting('max_upvotes'), $slide->stage, $slide->is_voting_open,
|
$slide->type, $slide->setting('upvote_share'), $slide->stage, $slide->is_voting_open,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->get("/admin/$token");
|
$this->get("/admin/$token");
|
||||||
$this->assertResponseContains('Fragen sammeln');
|
$this->assertResponseContains('Fragen sammeln');
|
||||||
$this->assertResponseContains('max. 5 Upvotes pro Person');
|
$this->assertResponseContains('Stimmen für 25 % der Fragen pro Person');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSwitchingOffUpvotesSkipsTheVotingStage(): void
|
public function testSwitchingOffUpvotesSkipsTheVotingStage(): void
|
||||||
{
|
{
|
||||||
[$poll, $token] = $this->createPoll();
|
[$poll, $token] = $this->createPoll();
|
||||||
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['max_upvotes' => 2]]);
|
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['upvote_share' => 50]]);
|
||||||
$this->goLive($poll, $slide);
|
$this->goLive($poll, $slide);
|
||||||
(new QaService())->setStage($slide, Slide::QA_VOTE);
|
(new QaService())->setStage($slide, Slide::QA_VOTE);
|
||||||
|
|
||||||
@@ -94,11 +94,11 @@ class QaSlideTest extends TestCase
|
|||||||
// Switched off while voting: the round continues with the discussion.
|
// Switched off while voting: the round continues with the discussion.
|
||||||
$this->post("/admin/$token/slides/{$slide->id}/edit", [
|
$this->post("/admin/$token/slides/{$slide->id}/edit", [
|
||||||
'question' => $slide->question,
|
'question' => $slide->question,
|
||||||
'settings' => ['max_upvotes' => '0', 'max_upvotes_per_question' => '0'],
|
'settings' => ['upvote_share' => '0', 'max_upvotes_per_question' => '0'],
|
||||||
]);
|
]);
|
||||||
$this->assertRedirect();
|
$this->assertRedirect();
|
||||||
$slide = $this->slidesTable()->get($slide->id);
|
$slide = $this->slidesTable()->get($slide->id);
|
||||||
$this->assertSame([0, Slide::QA_DISCUSS, false], [$slide->setting('max_upvotes'), $slide->qaStage(), $slide->is_voting_open]);
|
$this->assertSame([0, Slide::QA_DISCUSS, false], [$slide->setting('upvote_share'), $slide->qaStage(), $slide->is_voting_open]);
|
||||||
|
|
||||||
$this->get("/admin/$token");
|
$this->get("/admin/$token");
|
||||||
$this->assertResponseContains('ohne Upvotes');
|
$this->assertResponseContains('ohne Upvotes');
|
||||||
@@ -115,7 +115,7 @@ class QaSlideTest extends TestCase
|
|||||||
public function testFullRoundTrip(): void
|
public function testFullRoundTrip(): void
|
||||||
{
|
{
|
||||||
[$poll, $token] = $this->createPoll();
|
[$poll, $token] = $this->createPoll();
|
||||||
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['max_upvotes' => 1]]);
|
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['upvote_share' => 50]]);
|
||||||
$next = $this->createSlide($poll, Slide::TYPE_CONTENT);
|
$next = $this->createSlide($poll, Slide::TYPE_CONTENT);
|
||||||
$this->goLive($poll, $slide);
|
$this->goLive($poll, $slide);
|
||||||
$code = $poll->join_code;
|
$code = $poll->join_code;
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ class QaTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @return array{0: \App\Model\Entity\Poll, 1: \App\Model\Entity\Slide}
|
* @return array{0: \App\Model\Entity\Poll, 1: \App\Model\Entity\Slide}
|
||||||
*/
|
*/
|
||||||
protected function createQa(int $maxUpvotes = 2): array
|
protected function createQa(int $share = 50): array
|
||||||
{
|
{
|
||||||
[$poll] = $this->createPoll();
|
[$poll] = $this->createPoll();
|
||||||
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['max_upvotes' => $maxUpvotes]]);
|
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['upvote_share' => $share]]);
|
||||||
|
|
||||||
return [$this->goLive($poll, $slide), $slide];
|
return [$this->goLive($poll, $slide), $slide];
|
||||||
}
|
}
|
||||||
@@ -70,25 +70,35 @@ class QaTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSanitizesMaxUpvotes(): void
|
public function testSanitizesUpvoteShare(): void
|
||||||
{
|
{
|
||||||
[, $slide] = $this->createQa();
|
[, $slide] = $this->createQa();
|
||||||
$this->assertSame(2, $slide->setting('max_upvotes'));
|
$this->assertSame(50, $slide->setting('upvote_share'));
|
||||||
$this->assertSame(Slide::QA_COLLECT, $slide->qaStage());
|
$this->assertSame(Slide::QA_COLLECT, $slide->qaStage());
|
||||||
|
|
||||||
$table = $this->slidesTable();
|
$table = $this->slidesTable();
|
||||||
$this->assertSame(0, $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => '0']])->setting('max_upvotes'));
|
$share = fn(string $value) => $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['upvote_share' => $value]])->setting('upvote_share');
|
||||||
$this->assertSame(0, $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => '-3']])->setting('max_upvotes'));
|
$this->assertSame(0, $share('0'));
|
||||||
$this->assertSame(10, $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => '99']])->setting('max_upvotes'));
|
$this->assertSame(33, $share('33'));
|
||||||
|
$this->assertSame(25, $share('-3'), 'invalid values fall back to the default');
|
||||||
|
$this->assertSame(25, $share('99'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testBudgetGrowsWithTheNumberOfQuestions(): void
|
||||||
|
{
|
||||||
|
[, $slide] = $this->createQa(25);
|
||||||
|
$this->assertSame([0, 1, 1, 1, 2, 3, 25], array_map($slide->qaBudget(...), [0, 1, 4, 3, 5, 12, 100]));
|
||||||
|
[, $off] = $this->createQa(0);
|
||||||
|
$this->assertSame(0, $off->qaBudget(10));
|
||||||
|
|
||||||
|
$table = $this->slidesTable();
|
||||||
$this->assertSame(0, $slide->setting('max_upvotes_per_question'));
|
$this->assertSame(0, $slide->setting('max_upvotes_per_question'));
|
||||||
$patched = $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => '5', 'max_upvotes_per_question' => '2']]);
|
$patched = $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['upvote_share' => '25', 'max_upvotes_per_question' => '2']]);
|
||||||
$this->assertSame([2, 2], [$patched->setting('max_upvotes_per_question'), $patched->qaUpvotesPerQuestion()]);
|
$this->assertSame([2, 2, 1], [$patched->setting('max_upvotes_per_question'), $patched->qaUpvotesPerQuestion(5), $patched->qaUpvotesPerQuestion(1)]);
|
||||||
$patched = $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => '3', 'max_upvotes_per_question' => '99']]);
|
$patched = $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes_per_question' => '99']]);
|
||||||
// Never more per question than in total.
|
// Never more per question than in total.
|
||||||
$this->assertSame([10, 3], [$patched->setting('max_upvotes_per_question'), $patched->qaUpvotesPerQuestion()]);
|
$this->assertSame([10, 3], [$patched->setting('max_upvotes_per_question'), $patched->qaUpvotesPerQuestion(3)]);
|
||||||
$patched = $table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => '4', 'max_upvotes_per_question' => '0']]);
|
$this->assertSame(4, $slide->qaUpvotesPerQuestion(4), '0 = no limit per question');
|
||||||
$this->assertSame(4, $patched->qaUpvotesPerQuestion(), '0 = no limit per question');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithoutUpvotesThereIsNoVotingStage(): void
|
public function testWithoutUpvotesThereIsNoVotingStage(): void
|
||||||
@@ -122,10 +132,14 @@ class QaTest extends TestCase
|
|||||||
public function testUpvotesPerQuestionAreLimited(): void
|
public function testUpvotesPerQuestionAreLimited(): void
|
||||||
{
|
{
|
||||||
[$poll] = $this->createPoll();
|
[$poll] = $this->createPoll();
|
||||||
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['max_upvotes' => 3, 'max_upvotes_per_question' => 1]]);
|
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['upvote_share' => 50, 'max_upvotes_per_question' => 1]]);
|
||||||
$poll = $this->goLive($poll, $slide);
|
$poll = $this->goLive($poll, $slide);
|
||||||
$a = $this->ask($poll, $slide, 'p1', 'Frage A');
|
$a = $this->ask($poll, $slide, 'p1', 'Frage A');
|
||||||
$b = $this->ask($poll, $slide, 'p1', 'Frage B');
|
$b = $this->ask($poll, $slide, 'p1', 'Frage B');
|
||||||
|
// Six questions at 50 % make a budget of three votes.
|
||||||
|
foreach (['C', 'D', 'E', 'F'] as $letter) {
|
||||||
|
$this->ask($poll, $slide, 'p1', 'Frage ' . $letter);
|
||||||
|
}
|
||||||
$slide = $this->stage($slide, Slide::QA_VOTE);
|
$slide = $this->stage($slide, Slide::QA_VOTE);
|
||||||
|
|
||||||
$this->vote($poll, $slide, 'p2', $a);
|
$this->vote($poll, $slide, 'p2', $a);
|
||||||
@@ -138,7 +152,7 @@ class QaTest extends TestCase
|
|||||||
$state = (new PollStateService())->forParticipant($poll, 'p2')['qa'];
|
$state = (new PollStateService())->forParticipant($poll, 'p2')['qa'];
|
||||||
$this->assertEquals([1, 1, [$a => 1, $b => 1]], [$state['maxPerQuestion'], $state['votesLeft'], $state['upvoted']]);
|
$this->assertEquals([1, 1, [$a => 1, $b => 1]], [$state['maxPerQuestion'], $state['votesLeft'], $state['upvoted']]);
|
||||||
|
|
||||||
$this->slidesTable()->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => 3, 'max_upvotes_per_question' => 2]]);
|
$this->slidesTable()->patchEntity($slide, ['type' => 'qa', 'settings' => ['upvote_share' => 50, 'max_upvotes_per_question' => 2]]);
|
||||||
$this->slidesTable()->saveOrFail($slide);
|
$this->slidesTable()->saveOrFail($slide);
|
||||||
$this->vote($poll, $slide, 'p2', $a);
|
$this->vote($poll, $slide, 'p2', $a);
|
||||||
$this->vote($poll, $slide, 'p3', $b);
|
$this->vote($poll, $slide, 'p3', $b);
|
||||||
@@ -180,10 +194,12 @@ class QaTest extends TestCase
|
|||||||
|
|
||||||
public function testUpvotesAreABudgetThatCanBeStackedAndWithdrawn(): void
|
public function testUpvotesAreABudgetThatCanBeStackedAndWithdrawn(): void
|
||||||
{
|
{
|
||||||
[$poll, $slide] = $this->createQa(3);
|
[$poll, $slide] = $this->createQa(50);
|
||||||
$a = $this->ask($poll, $slide, 'p1', 'Frage A');
|
$a = $this->ask($poll, $slide, 'p1', 'Frage A');
|
||||||
$b = $this->ask($poll, $slide, 'p2', 'Frage B');
|
$b = $this->ask($poll, $slide, 'p2', 'Frage B');
|
||||||
$c = $this->ask($poll, $slide, 'p2', 'Frage C');
|
$c = $this->ask($poll, $slide, 'p2', 'Frage C');
|
||||||
|
// Six questions at 50 % make a budget of three votes.
|
||||||
|
$rest = array_map(fn(string $x) => $this->ask($poll, $slide, 'p9', 'Frage ' . $x), ['D', 'E', 'F']);
|
||||||
$slide = $this->stage($slide, Slide::QA_VOTE);
|
$slide = $this->stage($slide, Slide::QA_VOTE);
|
||||||
$this->assertTrue($slide->isVotingOpen());
|
$this->assertTrue($slide->isVotingOpen());
|
||||||
|
|
||||||
@@ -205,11 +221,11 @@ class QaTest extends TestCase
|
|||||||
|
|
||||||
// While voting is open, the stage only gets the total: no ranking, no counts per question.
|
// While voting is open, the stage only gets the total: no ranking, no counts per question.
|
||||||
$results = (new ResultsService())->forSlide($slide);
|
$results = (new ResultsService())->forSlide($slide);
|
||||||
$this->assertSame([$a, $b, $c], array_column($results['questions'], 'id'));
|
$this->assertSame([$a, $b, $c, ...$rest], array_column($results['questions'], 'id'));
|
||||||
$this->assertArrayNotHasKey('votes', $results['questions'][0]);
|
$this->assertArrayNotHasKey('votes', $results['questions'][0]);
|
||||||
$this->assertSame(4, $results['upvotes']);
|
$this->assertSame(4, $results['upvotes']);
|
||||||
$ranked = (new QaService())->rankedQuestions($slide);
|
$ranked = (new QaService())->rankedQuestions($slide);
|
||||||
$this->assertSame([[$b, 3], [$a, 1], [$c, 0]], array_map(fn($q) => [$q['id'], $q['votes']], $ranked));
|
$this->assertSame([[$b, 3], [$a, 1], [$c, 0], [$rest[0], 0], [$rest[1], 0], [$rest[2], 0]], array_map(fn($q) => [$q['id'], $q['votes']], $ranked));
|
||||||
|
|
||||||
$this->vote($poll, $slide, 'p3', $b, 'remove');
|
$this->vote($poll, $slide, 'p3', $b, 'remove');
|
||||||
$this->assertSame(2, (new QaService())->rankedQuestions($slide)[0]['votes'], 'remove withdraws only one upvote');
|
$this->assertSame(2, (new QaService())->rankedQuestions($slide)[0]['votes'], 'remove withdraws only one upvote');
|
||||||
@@ -217,7 +233,7 @@ class QaTest extends TestCase
|
|||||||
|
|
||||||
// Voting view of participants: all questions, submission order, no counts.
|
// Voting view of participants: all questions, submission order, no counts.
|
||||||
$state = (new PollStateService())->forParticipant($poll, 'p3');
|
$state = (new PollStateService())->forParticipant($poll, 'p3');
|
||||||
$this->assertSame([$a, $b, $c], array_column($state['qa']['questions'], 'id'));
|
$this->assertSame([$a, $b, $c, ...$rest], array_column($state['qa']['questions'], 'id'));
|
||||||
$this->assertArrayNotHasKey('votes', $state['qa']['questions'][0]);
|
$this->assertArrayNotHasKey('votes', $state['qa']['questions'][0]);
|
||||||
$this->assertSame([$b => 2, $a => 1], $state['qa']['upvoted']);
|
$this->assertSame([$b => 2, $a => 1], $state['qa']['upvoted']);
|
||||||
$this->assertSame(0, $state['qa']['votesLeft']);
|
$this->assertSame(0, $state['qa']['votesLeft']);
|
||||||
@@ -231,13 +247,17 @@ class QaTest extends TestCase
|
|||||||
$this->assertFalse($slide->setting('allow_self_upvote'));
|
$this->assertFalse($slide->setting('allow_self_upvote'));
|
||||||
$table = $this->slidesTable();
|
$table = $this->slidesTable();
|
||||||
$this->assertTrue($table->patchEntity($slide, ['type' => 'qa', 'settings' => ['allow_self_upvote' => '1']])->setting('allow_self_upvote'));
|
$this->assertTrue($table->patchEntity($slide, ['type' => 'qa', 'settings' => ['allow_self_upvote' => '1']])->setting('allow_self_upvote'));
|
||||||
$this->assertFalse($table->patchEntity($slide, ['type' => 'qa', 'settings' => ['max_upvotes' => '2']])->setting('allow_self_upvote'));
|
$this->assertFalse($table->patchEntity($slide, ['type' => 'qa', 'settings' => ['upvote_share' => '20']])->setting('allow_self_upvote'));
|
||||||
|
|
||||||
[$poll] = $this->createPoll();
|
[$poll] = $this->createPoll();
|
||||||
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['max_upvotes' => 3, 'allow_self_upvote' => true]]);
|
$slide = $this->createSlide($poll, Slide::TYPE_QA, ['settings' => ['upvote_share' => 25, 'allow_self_upvote' => true]]);
|
||||||
$poll = $this->goLive($poll, $slide);
|
$poll = $this->goLive($poll, $slide);
|
||||||
$a = $this->ask($poll, $slide, 'p1', 'Thema A');
|
$a = $this->ask($poll, $slide, 'p1', 'Thema A');
|
||||||
$b = $this->ask($poll, $slide, 'p2', 'Thema B');
|
$b = $this->ask($poll, $slide, 'p2', 'Thema B');
|
||||||
|
// Twelve questions at 25 % make a budget of three votes.
|
||||||
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
|
$this->ask($poll, $slide, 'p3', 'Thema ' . $i);
|
||||||
|
}
|
||||||
$slide = $this->stage($slide, Slide::QA_VOTE);
|
$slide = $this->stage($slide, Slide::QA_VOTE);
|
||||||
|
|
||||||
// Own questions take votes from the same budget, stacked and withdrawn like any other.
|
// Own questions take votes from the same budget, stacked and withdrawn like any other.
|
||||||
@@ -255,7 +275,7 @@ class QaTest extends TestCase
|
|||||||
|
|
||||||
public function testDiscussStepsThroughQuestionsByRank(): void
|
public function testDiscussStepsThroughQuestionsByRank(): void
|
||||||
{
|
{
|
||||||
[$poll, $slide] = $this->createQa(3);
|
[$poll, $slide] = $this->createQa(50);
|
||||||
$a = $this->ask($poll, $slide, 'p1', 'Frage A');
|
$a = $this->ask($poll, $slide, 'p1', 'Frage A');
|
||||||
$b = $this->ask($poll, $slide, 'p1', 'Frage B');
|
$b = $this->ask($poll, $slide, 'p1', 'Frage B');
|
||||||
$slide = $this->stage($slide, Slide::QA_VOTE);
|
$slide = $this->stage($slide, Slide::QA_VOTE);
|
||||||
|
|||||||
@@ -573,6 +573,9 @@ textarea { resize: vertical; }
|
|||||||
.qa-focus__nav:empty { display: none; }
|
.qa-focus__nav:empty { display: none; }
|
||||||
.qa-list--compact .qa-item { padding: 8px 12px; }
|
.qa-list--compact .qa-item { padding: 8px 12px; }
|
||||||
.qa-summary { color: var(--muted); margin: 0 0 1em; }
|
.qa-summary { color: var(--muted); margin: 0 0 1em; }
|
||||||
|
.qa-vote-hint { text-align: center; padding: 8vh 16px 4vh; }
|
||||||
|
.qa-vote-hint__title { margin: 0 0 .3em; font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 800; color: var(--qa); }
|
||||||
|
.qa-vote-hint__text { margin: 0 auto 1.2em; max-width: 30em; font-size: clamp(1.1rem, 2.6vw, 1.6rem); }
|
||||||
.qa-steps { list-style: none; padding: 0; margin: 0 0 1em; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: none; }
|
.qa-steps { list-style: none; padding: 0; margin: 0 0 1em; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: none; }
|
||||||
.qa-steps__step { display: inline-block; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-size: .85em; }
|
.qa-steps__step { display: inline-block; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-size: .85em; }
|
||||||
button.qa-steps__step { cursor: pointer; }
|
button.qa-steps__step { cursor: pointer; }
|
||||||
|
|||||||
@@ -1026,16 +1026,16 @@
|
|||||||
return el('li', { class: 'answer', text: question.text });
|
return el('li', { class: 'answer', text: question.text });
|
||||||
})));
|
})));
|
||||||
} else if (results.stage === 'vote') {
|
} else if (results.stage === 'vote') {
|
||||||
children.push(el('p', { class: 'qa-summary', text: 'Abstimmen: jede Person hat '
|
// The questions are voted on at the participants' devices: the stage only points there
|
||||||
+ results.maxUpvotes + (results.maxUpvotes === 1 ? ' Stimme' : ' Stimmen')
|
// (no list, counts or ranking, so it can not sway the vote).
|
||||||
|
children.push(el('div', { class: 'qa-vote-hint' }, [
|
||||||
|
el('p', { class: 'qa-vote-hint__title', text: 'Jetzt abstimmen!' }),
|
||||||
|
el('p', { class: 'qa-vote-hint__text', text: 'Schau auf dein Gerät und gib deine Stimmen den Fragen, die dir wichtig sind.' }),
|
||||||
|
el('p', { class: 'qa-summary', text: questions.length + (questions.length === 1 ? ' Frage' : ' Fragen')
|
||||||
|
+ ' · jede Person hat ' + results.maxUpvotes + (results.maxUpvotes === 1 ? ' Stimme' : ' Stimmen')
|
||||||
+ (results.maxPerQuestion < results.maxUpvotes ? ' (höchstens ' + results.maxPerQuestion + ' pro Frage)' : '')
|
+ (results.maxPerQuestion < results.maxUpvotes ? ' (höchstens ' + results.maxPerQuestion + ' pro Frage)' : '')
|
||||||
+ ' · bisher ' + results.upvotes + ' vergeben' }));
|
+ ' · bisher ' + results.upvotes + ' vergeben' })
|
||||||
// No counts or ranking while voting is open (the server sends none), so the stage does not sway the vote.
|
]));
|
||||||
children.push(el('ul', { class: 'qa-list' }, questions.map(function (question) {
|
|
||||||
return el('li', { class: 'qa-item' }, [
|
|
||||||
el('span', { class: 'qa-item__text', text: question.text })
|
|
||||||
]);
|
|
||||||
})));
|
|
||||||
} else if (questions.length === 0) {
|
} else if (questions.length === 0) {
|
||||||
children.push(el('p', { class: 'qa-summary', text: 'Es wurden keine Fragen eingereicht.' }));
|
children.push(el('p', { class: 'qa-summary', text: 'Es wurden keine Fragen eingereicht.' }));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user