From 7fd4a0da8ced99060ffa976453d7cbf96c6ce716 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Sat, 21 Nov 2026 09:21:30 +0100 Subject: [PATCH] Close an open ordering slide on "next" before moving on Forward in the presenter view now reveals the solution first (like the quiz build steps) instead of skipping straight to the next slide. Co-Authored-By: Claude Sonnet 5.5 --- docs/slide-types.md | 1 + src/Controller/AdminController.php | 9 ++++++++- tests/TestCase/Controller/OrderSlideTest.php | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/slide-types.md b/docs/slide-types.md index 6fc47ba..8d641dd 100644 --- a/docs/slide-types.md +++ b/docs/slide-types.md @@ -81,6 +81,7 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw. per Drag & Drop/Pfeiltasten sortierbar, ids bleiben beim Umsortieren erhalten). Teilnehmende bekommen sie per `Slide::shuffledOptions(participantHash)` gemischt (stabil, nie schon richtig), sortieren und senden `order[]` (alle ids genau einmal), einmal pro Person. Startet offen wie normale Folien; **aufgelöst wird beim Schließen der Abstimmung** (`Slide::isOrderRevealed()`). + „Weiter“ (→/Leertaste) schließt eine noch offene Reihenfolge-Folie zuerst (Auflösung) und wechselt erst beim nächsten Druck. Vorher landen weder richtige Reihenfolge noch Zählungen im JSON (Presenter sieht die Einträge gemischt mit Seed `slide:{id}`); danach sieht der Presenter die Lösung inkl. „X von N komplett richtig“ und je Eintrag, wie oft er an der richtigen Stelle lag; Teilnehmende nur die Lösung mit eigenen Platzierungen und `order.isCorrect`. Tests: `OrderTest.php`, `OrderSlideTest.php`. diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 0fc4442..81e4019 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -236,7 +236,8 @@ class AdminController extends AdminAppController * * On a Q&A slide that is being discussed, next/prev step through the questions * first (like builds in presentation software); on a quiz, next starts it and then ends it - * before moving on, prev always goes to the previous slide. While paused, next/prev resume + * before moving on, on an open ordering slide next closes it (reveals the solution), + * prev always goes to the previous slide. While paused, next/prev resume * the slide that was live before. * * Answers with the new state as JSON for XHR requests, otherwise redirects back. @@ -270,6 +271,12 @@ class AdminController extends AdminAppController } } + // Same for an ordering slide: forward first closes the voting (reveals the solution). + if ($current !== null && $current->isOrder() && $action === 'next' && $current->isVotingOpen()) { + (new SlideControlService())->apply($current, 'close'); + $action = 'none'; + } + switch ($action) { case 'none': break; diff --git a/tests/TestCase/Controller/OrderSlideTest.php b/tests/TestCase/Controller/OrderSlideTest.php index 30db76f..fd619a8 100644 --- a/tests/TestCase/Controller/OrderSlideTest.php +++ b/tests/TestCase/Controller/OrderSlideTest.php @@ -93,6 +93,24 @@ class OrderSlideTest extends TestCase $this->assertStringContainsString('komplett richtig sortiert', $html); } + public function testNextRevealsAnOpenOrderSlideBeforeMovingOn(): void + { + [$poll, $token] = $this->createPoll(); + $order = $this->createSlide($poll, Slide::TYPE_ORDER, [], ['Eins', 'Zwei', 'Drei']); + $next = $this->createSlide($poll, Slide::TYPE_CONTENT); + $this->goLive($poll, $order); + + // First forward closes the voting (solution), the slide stays live. + $this->post("/admin/$token/control", ['action' => 'next']); + $poll = $this->pollsTable()->get($poll->id); + $this->assertSame($order->id, $poll->current_slide_id); + $this->assertFalse($this->slidesTable()->get($order->id)->isVotingOpen()); + + // A second forward (and a repeated one) really moves on. + $this->post("/admin/$token/control", ['action' => 'next']); + $this->assertSame($next->id, $this->pollsTable()->get($poll->id)->current_slide_id); + } + public function testRankingHasNoSolutionAndShowsAverageOrder(): void { [$poll, $token] = $this->createPoll(); -- 2.54.1