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

+3 -2
View File
@@ -217,6 +217,7 @@ class ResultsService
{
$questions = (new QaService())->rankedQuestions($slide);
$upvotes = array_sum(array_column($questions, 'votes'));
$budget = $slide->qaBudget(count($questions));
if ($slide->qaStage() === Slide::QA_VOTE) {
// 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']);
@@ -232,8 +233,8 @@ class ResultsService
return [
'stage' => $slide->qaStage(),
'stages' => $slide->qaStages(),
'maxUpvotes' => (int)$slide->setting('max_upvotes'),
'maxPerQuestion' => $slide->qaUpvotesPerQuestion(),
'maxUpvotes' => $budget,
'maxPerQuestion' => $slide->qaUpvotesPerQuestion($budget),
'upvotes' => $upvotes,
'questions' => $questions,
'focusId' => $focusIndex === null ? null : $slide->focus_response_id,