Walk through Q&A stages with "next" before leaving the slide #127

Merged
gnilebein merged 1 commits from fix/qa-next-stages into main 2026-11-21 13:51:37 +01:00
3 changed files with 28 additions and 9 deletions

No files matched your search

+3 -2
View File
@@ -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, 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 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. „Weiter“ (next, →/Klicker) geht
(→/←, Klicker) zuerst durch die Fragen, erst danach durch die Folien. Fokuswechsel per `updateAll` ohne `modified`, 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()`. damit Teilnehmerseiten nicht neu laden. Teilnehmende bekommen nie `results`, sondern `qa` aus `PollStateService::qaState()`.
Zurücksetzen startet wieder bei `collect`. Zurücksetzen startet wieder bei `collect`.
**Vorab eingereichte Fragen** (z. B. per Mail): Textarea `prepared_text` im Folienformular (eine Frage pro Zeile, höchstens **Vorab eingereichte Fragen** (z. B. per Mail): Textarea `prepared_text` im Folienformular (eine Frage pro Zeile, höchstens
+7 -7
View File
@@ -341,13 +341,13 @@ class AdminController extends AdminAppController
$ids = array_map(fn(Slide $s) => $s->id, $slides); $ids = array_map(fn(Slide $s) => $s->id, $slides);
$index = array_search($this->poll->current_slide_id, $ids, true); $index = array_search($this->poll->current_slide_id, $ids, true);
$current = $index === false ? null : $slides[$index]; $current = $index === false ? null : $slides[$index];
if ( // Q&A: forward first walks through the stages (collect → vote → discuss), then through the questions,
$current !== null // only after the last one it goes to the next slide. Back only steps through the questions.
&& $current->isQa() if ($current !== null && $current->isQa() && in_array($action, ['next', 'prev'], true)) {
&& in_array($action, ['next', 'prev'], true) $qa = new QaService();
&& (new QaService())->moveFocus($current, $action === 'next' ? 1 : -1) if ($qa->moveFocus($current, $action === 'next' ? 1 : -1) || ($action === 'next' && $qa->advance($current))) {
) { $action = 'none';
$action = 'none'; }
} }
// Forward on a slide with a countdown (every quiz, any other slide with a time limit) is a build step too: // 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. // start it, then end it, only then the next slide.
@@ -172,6 +172,24 @@ class AdminControllerTest extends TestCase
$this->assertSame(Slide::QUIZ_READY, $slide->quizPhase()); $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 public function testEditKeepsVotesOfUnchangedOptions(): void
{ {
[$poll, $token] = $this->createPoll(); [$poll, $token] = $this->createPoll();