diff --git a/docs/slide-types.md b/docs/slide-types.md index 7250abb..91cef65 100644 --- a/docs/slide-types.md +++ b/docs/slide-types.md @@ -83,8 +83,9 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw. 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 - 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`, + sortiert (Gleichstand: älteste zuerst), `focus_response_id` = aktuelle Frage. „Weiter“ (next, →/Klicker) geht + zuerst durch die Phasen (`collect` → `vote` → `discuss`, `QaService::advance()`), dann durch die Fragen, erst danach zur nächsten Folie; + „Zurück“ blättert nur in `discuss` durch die Fragen. Fokuswechsel per `updateAll` ohne `modified`, damit Teilnehmerseiten nicht neu laden. Teilnehmende bekommen nie `results`, sondern `qa` aus `PollStateService::qaState()`. Zurücksetzen startet wieder bei `collect`. **Vorab eingereichte Fragen** (z. B. per Mail): Textarea `prepared_text` im Folienformular (eine Frage pro Zeile, höchstens diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 67889dd..6656f8c 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -341,13 +341,13 @@ class AdminController extends AdminAppController $ids = array_map(fn(Slide $s) => $s->id, $slides); $index = array_search($this->poll->current_slide_id, $ids, true); $current = $index === false ? null : $slides[$index]; - if ( - $current !== null - && $current->isQa() - && in_array($action, ['next', 'prev'], true) - && (new QaService())->moveFocus($current, $action === 'next' ? 1 : -1) - ) { - $action = 'none'; + // Q&A: forward first walks through the stages (collect → vote → discuss), then through the questions, + // only after the last one it goes to the next slide. Back only steps through the questions. + if ($current !== null && $current->isQa() && in_array($action, ['next', 'prev'], true)) { + $qa = new QaService(); + if ($qa->moveFocus($current, $action === 'next' ? 1 : -1) || ($action === 'next' && $qa->advance($current))) { + $action = 'none'; + } } // Forward on a slide with a countdown (every quiz, any other slide with a time limit) is a build step too: // start it, then end it, only then the next slide. diff --git a/tests/TestCase/Controller/AdminControllerTest.php b/tests/TestCase/Controller/AdminControllerTest.php index ae36f73..dc0c90b 100644 --- a/tests/TestCase/Controller/AdminControllerTest.php +++ b/tests/TestCase/Controller/AdminControllerTest.php @@ -172,6 +172,24 @@ class AdminControllerTest extends TestCase $this->assertSame(Slide::QUIZ_READY, $slide->quizPhase()); } + public function testForwardOnQaWalksThroughStagesBeforeNextSlide(): void + { + [$poll, $token] = $this->createPoll(); + $qa = $this->createSlide($poll, Slide::TYPE_QA, [], []); + $this->createSlide($poll); + $this->goLive($poll, $qa); + + $this->post("/admin/$token/control", ['action' => 'next']); + $this->assertSame(Slide::QA_VOTE, $this->slidesTable()->get($qa->id)->qaStage()); + $this->post("/admin/$token/control", ['action' => 'next']); + $this->assertSame(Slide::QA_DISCUSS, $this->slidesTable()->get($qa->id)->qaStage()); + $this->assertSame($qa->id, $this->pollsTable()->get($poll->id)->current_slide_id); + + // No questions to step through: now it goes to the next slide. + $this->post("/admin/$token/control", ['action' => 'next']); + $this->assertNotSame($qa->id, $this->pollsTable()->get($poll->id)->current_slide_id); + } + public function testEditKeepsVotesOfUnchangedOptions(): void { [$poll, $token] = $this->createPoll();