diff --git a/AGENTS.md b/AGENTS.md index 88cd67d..4c6d062 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -165,7 +165,8 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures 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 (State `qa.allowSelfUpvote`); bewusst aus, weil anonym sonst Selbstvermarktung die Rangfolge bestimmt; - Teilnehmende sehen alle Fragen in Eingangsreihenfolge **ohne** Zählung. `discuss`: Abstimmung zu, Fragen nach Upvotes + Teilnehmende sehen alle Fragen in Eingangsreihenfolge **ohne** Zählung; auch die Bühne (Presenter/Embed, PDF) bekommt in `vote` + 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 (→/←, Klicker) zuerst durch die Fragen, erst danach durch die Folien. Fokuswechsel per `updateAll` ohne `modified`, damit Teilnehmerseiten nicht neu laden. Teilnehmende bekommen nie `results`, sondern `qa` aus `PollStateService::qaState()`. diff --git a/src/Service/ResultsService.php b/src/Service/ResultsService.php index 61ceee9..f383458 100644 --- a/src/Service/ResultsService.php +++ b/src/Service/ResultsService.php @@ -40,7 +40,8 @@ use Cake\ORM\Locator\LocatorAwareTrait; * - qa: 'stage' (collect|vote|discuss), 'stages' (available stages in order, no 'vote' without upvotes), * 'maxUpvotes' (per participant, 0 = no upvotes), 'maxPerQuestion' (per participant and question), * 'upvotes' (total), - * 'questions' => [['id', 'text', 'votes']] most upvoted first (ties: oldest first), + * 'questions' => [['id', 'text', 'votes']] most upvoted first (ties: oldest first); + * during 'vote' only [['id', 'text']] in submission order (no counts while voting is open), * 'focusId' (question being discussed|null), 'focusIndex' (0-based position in questions|null). * Presenter only – participants get their own view, see PollStateService::qaState(). */ @@ -215,6 +216,12 @@ class ResultsService protected function qa(Slide $slide): array { $questions = (new QaService())->rankedQuestions($slide); + $upvotes = array_sum(array_column($questions, 'votes')); + 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']); + $questions = array_map(fn($q) => ['id' => $q['id'], 'text' => $q['text']], $questions); + } $focusIndex = null; foreach ($questions as $index => $question) { if ($question['id'] === $slide->focus_response_id) { @@ -227,7 +234,7 @@ class ResultsService 'stages' => $slide->qaStages(), 'maxUpvotes' => (int)$slide->setting('max_upvotes'), 'maxPerQuestion' => $slide->qaUpvotesPerQuestion(), - 'upvotes' => array_sum(array_column($questions, 'votes')), + 'upvotes' => $upvotes, 'questions' => $questions, 'focusId' => $focusIndex === null ? null : $slide->focus_response_id, 'focusIndex' => $focusIndex, diff --git a/templates/Admin/export.php b/templates/Admin/export.php index 020e1a1..bd8aefa 100644 --- a/templates/Admin/export.php +++ b/templates/Admin/export.php @@ -213,7 +213,7 @@ $bar = function (float $percent, bool $ok = false): string {
= __('Keine Fragen eingereicht.') ?>
- 0; ?> + 0 && $r['stage'] !== 'vote'; ?>| # | = __('Frage') ?> | = __('Upvotes') ?> |
|---|