Keep results off participant devices
Results belong on the stage. Participants only get results where they interact with them (word cloud with upvotes) and, once resolved, the solution of quiz and ordering slides with their own verdict, without counts or distribution. Removes the per-poll setting show_results_to_participants (column stays unused). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ecb8f9d31c
commit
cfb445123e
14 files changed
+86
-59
No files matched your search
@@ -55,7 +55,7 @@ class AdminControllerTest extends TestCase
|
||||
$this->get("/admin/$token");
|
||||
$this->assertResponseNotContains('name="_method" value="PUT"', 'settings form must not override method');
|
||||
|
||||
$this->post("/admin/$token/settings", ['title' => 'Neu', 'is_active' => '1', 'show_results_to_participants' => '0']);
|
||||
$this->post("/admin/$token/settings", ['title' => 'Neu', 'is_active' => '1']);
|
||||
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
|
||||
$this->assertSame('Neu', $this->pollsTable()->get($poll->id)->title);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class ParticipateControllerTest extends TestCase
|
||||
$this->assertSame(0, TableRegistry::getTableLocator()->get('Responses')->find()->count());
|
||||
}
|
||||
|
||||
public function testStateHidesResultsUntilAnswered(): void
|
||||
public function testStateNeverContainsResults(): void
|
||||
{
|
||||
[$poll] = $this->createPoll();
|
||||
$slide = $this->createSlide($poll, Slide::TYPE_SCALE);
|
||||
@@ -96,14 +96,18 @@ class ParticipateControllerTest extends TestCase
|
||||
$this->get("/p/{$poll->join_code}/state");
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
$this->assertTrue($state['hasResponded']);
|
||||
$this->assertEqualsWithDelta(4.0, $state['results']['average'], 0.001);
|
||||
// Results are for the stage only, not even after answering or closing.
|
||||
$this->assertNull($state['results']);
|
||||
|
||||
$this->slidesTable()->updateAll(['is_voting_open' => false], ['id' => $slide->id]);
|
||||
$this->cookie('plenario_pid', self::PID);
|
||||
$this->get("/p/{$poll->join_code}/state");
|
||||
$this->assertNull(json_decode((string)$this->_response->getBody(), true)['results']);
|
||||
}
|
||||
|
||||
public function testWordcloudAjaxVoteReturnsStateWithUpvoteCloud(): void
|
||||
{
|
||||
[$poll] = $this->createPoll();
|
||||
$poll->show_results_to_participants = false;
|
||||
$this->pollsTable()->saveOrFail($poll);
|
||||
$slide = $this->createSlide($poll, Slide::TYPE_WORDCLOUD, ['settings' => ['allow_upvotes' => true]]);
|
||||
$this->goLive($poll, $slide);
|
||||
|
||||
@@ -114,7 +118,7 @@ class ParticipateControllerTest extends TestCase
|
||||
$body = json_decode((string)$this->_response->getBody(), true);
|
||||
$this->assertTrue($body['ok']);
|
||||
$this->assertSame(['kaffee'], $body['state']['words']['mine']);
|
||||
// Cloud is visible despite show_results_to_participants=false, because upvotes are on.
|
||||
// The cloud reaches the device because participants upvote in it.
|
||||
$this->assertSame('Kaffee', $body['state']['results']['words'][0]['text']);
|
||||
|
||||
$this->cookie('plenario_pid', self::PID);
|
||||
|
||||
@@ -95,7 +95,6 @@ class PrivateFeedbackTest extends TestCase
|
||||
public function testParticipantsNeverSeeAnswers(): void
|
||||
{
|
||||
[$poll] = $this->privateSlideWithAnswer();
|
||||
$this->assertTrue($poll->show_results_to_participants);
|
||||
|
||||
$this->assertNull($this->participantState($poll)['results']);
|
||||
$this->get('/p/' . $poll->join_code);
|
||||
@@ -214,7 +213,6 @@ class PrivateFeedbackTest extends TestCase
|
||||
public function testParticipantsNeverSeeScaleResults(): void
|
||||
{
|
||||
[$poll] = $this->privateScaleWithRatings();
|
||||
$this->assertTrue($poll->show_results_to_participants);
|
||||
|
||||
$this->assertNull($this->participantState($poll)['results']);
|
||||
$this->get('/p/' . $poll->join_code);
|
||||
|
||||
@@ -157,14 +157,13 @@ class ScaleCommentsTest extends TestCase
|
||||
public function testParticipantsNeverSeeComments(): void
|
||||
{
|
||||
[$poll] = $this->scaleWithComments();
|
||||
$this->assertTrue($poll->show_results_to_participants);
|
||||
// Participant "a" has already rated and sees the results – but not the comments.
|
||||
// Participant "a" has already rated – results stay on the stage.
|
||||
$this->cookie('plenario_pid', str_repeat('a', 32));
|
||||
|
||||
$this->get('/p/' . $poll->join_code . '/state');
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
$this->assertNotEmpty($state['results']['buckets']);
|
||||
$this->assertSame([], $state['results']['comments']);
|
||||
$this->assertTrue($state['hasResponded']);
|
||||
$this->assertNull($state['results']);
|
||||
$this->assertResponseNotContains('Zu lang');
|
||||
|
||||
$this->get('/p/' . $poll->join_code);
|
||||
|
||||
@@ -149,14 +149,15 @@ class OrderTest extends TestCase
|
||||
$this->assertSame([1, 2, 3, 4], array_column($results['items'], 'position'));
|
||||
$this->assertSame([2, 2, 3, 3], array_column($results['items'], 'placed'));
|
||||
|
||||
// Revealed even without show_results_to_participants.
|
||||
$poll->show_results_to_participants = false;
|
||||
$this->pollsTable()->saveOrFail($poll);
|
||||
// Participants get the solution and their own verdict, but no counts.
|
||||
$wrong = $this->participantState($poll, 'p2');
|
||||
$this->assertTrue($wrong['order']['revealed']);
|
||||
$this->assertFalse($wrong['order']['isCorrect']);
|
||||
$this->assertSame($this->ids($slide, ['Antike', 'Steinzeit', 'Mittelalter', 'Neuzeit']), $wrong['order']['answer']);
|
||||
$this->assertNotNull($wrong['results']);
|
||||
$this->assertSame([1, 2, 3, 4], array_column($wrong['results']['items'], 'position'));
|
||||
$this->assertArrayNotHasKey('correctCount', $wrong['results']);
|
||||
$this->assertArrayNotHasKey('placed', $wrong['results']['items'][0]);
|
||||
$this->assertArrayNotHasKey('percent', $wrong['results']['items'][0]);
|
||||
$this->assertTrue($this->participantState($poll, 'p1')['order']['isCorrect']);
|
||||
$this->assertNull($this->participantState($poll, 'nobody')['order']['isCorrect']);
|
||||
|
||||
|
||||
@@ -170,14 +170,15 @@ class QuizTest extends TestCase
|
||||
$this->assertSame(['Berlin', true, 2], [$results['options'][0]['label'], $results['options'][0]['correct'], $results['options'][0]['count']]);
|
||||
$this->assertFalse($results['options'][1]['correct']);
|
||||
|
||||
// Revealed to participants even without show_results_to_participants.
|
||||
$poll->show_results_to_participants = false;
|
||||
$this->pollsTable()->saveOrFail($poll);
|
||||
// Participants get the solution and their own verdict, but no distribution.
|
||||
$state = $this->participantState($poll, 'p2');
|
||||
$this->assertSame('finished', $state['quiz']['phase']);
|
||||
$this->assertFalse($state['quiz']['isCorrect']);
|
||||
$this->assertSame($this->optionId($slide, 'Hamburg'), $state['quiz']['answerId']);
|
||||
$this->assertNotNull($state['results']);
|
||||
$this->assertSame([true, false], array_slice(array_column($state['results']['options'], 'correct'), 0, 2));
|
||||
$this->assertArrayNotHasKey('correctCount', $state['results']);
|
||||
$this->assertArrayNotHasKey('count', $state['results']['options'][0]);
|
||||
$this->assertArrayNotHasKey('percent', $state['results']['options'][0]);
|
||||
$this->assertTrue($this->participantState($poll, 'p1')['quiz']['isCorrect']);
|
||||
$this->assertNull($this->participantState($poll, 'nobody')['quiz']['isCorrect']);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user