Make Q&A upvote budget a share of the questions
CI / Deploy / test (push) Successful in 58s
CI / Deploy / deploy (push) Skipped

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:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-11 23:53:32 +01:00
1 parent 3762b880cb
commit 575fb8649d
14 files changed
+171 -76

No files matched your search

+4 -4
View File
@@ -32,8 +32,8 @@ use Cake\Utility\Security;
* 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
* 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,
* at most `max_upvotes_per_question` if set; `max_upvotes` = 0 means no voting stage);
* 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; `upvote_share` = 0 means no voting stage);
* `remove` withdraws one own upvote of the question. `vote=edit|delete` + `question_id`
* changes or deletes an own question, only while collecting (see editQuestion()).
* - 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),
// up to the limit per question.
$max = (int)$slide->setting('max_upvotes');
$perQuestion = $slide->qaUpvotesPerQuestion();
$max = $slide->qaBudget($this->Responses->questionsOf($slide->id)->count());
$perQuestion = $slide->qaUpvotesPerQuestion($max);
if ($perQuestion < $max && count(array_keys($own['upvotes'], $id, true)) >= $perQuestion) {
throw new VoteException(__n(
'Du kannst jeder Frage nur eine Stimme geben.',