Make private slides start with hidden results instead of withholding them
Anonymous/internal feedback now only presets "hide results" on the stage: presenter and embed get the full results flagged private and can show them on demand. Participants still never get results of private slides, the public PDF export strips them via ResultsService::withoutContents(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d1facd32a6
commit
ecb8f9d31c
11 files changed
+143
-95
No files matched your search
@@ -12,7 +12,8 @@ use Cake\TestSuite\IntegrationTestTrait;
|
||||
use Cake\TestSuite\TestCase;
|
||||
|
||||
/**
|
||||
* Open questions and scales as anonymous/internal feedback: results only in the admin area.
|
||||
* Open questions and scales as anonymous/internal feedback: the stage starts with hidden results
|
||||
* (flag `private`, contents included so the presenter can show them), participants never get results.
|
||||
*/
|
||||
class PrivateFeedbackTest extends TestCase
|
||||
{
|
||||
@@ -78,17 +79,17 @@ class PrivateFeedbackTest extends TestCase
|
||||
$this->assertTrue($slide->isPrivate());
|
||||
}
|
||||
|
||||
public function testPresenterSeesOnlyTheCount(): void
|
||||
public function testPresenterGetsAnswersFlaggedPrivate(): void
|
||||
{
|
||||
[, $token] = $this->privateSlideWithAnswer();
|
||||
|
||||
$this->get("/admin/$token/state");
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
|
||||
// Flag = the stage starts with hidden results; showing them is the presenter's choice.
|
||||
$this->assertTrue($state['results']['private']);
|
||||
$this->assertSame([], $state['results']['answers']);
|
||||
$this->assertSame('Geheimes <Feedback>', $state['results']['answers'][0]['text']);
|
||||
$this->assertSame(1, $state['results']['participants']);
|
||||
$this->assertResponseNotContains('Geheimes');
|
||||
}
|
||||
|
||||
public function testParticipantsNeverSeeAnswers(): void
|
||||
@@ -107,15 +108,17 @@ class PrivateFeedbackTest extends TestCase
|
||||
$this->assertResponseNotContains('Geheimes');
|
||||
}
|
||||
|
||||
public function testEmbedSeesOnlyTheCount(): void
|
||||
public function testEmbedGetsAnswersFlaggedPrivate(): void
|
||||
{
|
||||
[$poll, , $slide] = $this->privateSlideWithAnswer();
|
||||
$key = $this->pollsTable()->ensureEmbedKey($poll);
|
||||
|
||||
$this->get("/e/$key/{$slide->id}/state");
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
|
||||
$this->assertResponseOk();
|
||||
$this->assertResponseNotContains('Geheimes');
|
||||
$this->assertTrue($state['results']['private']);
|
||||
$this->assertCount(1, $state['results']['answers']);
|
||||
}
|
||||
|
||||
public function testAdminReadsAnswers(): void
|
||||
@@ -195,7 +198,7 @@ class PrivateFeedbackTest extends TestCase
|
||||
$this->assertTrue($slide->isPrivate());
|
||||
}
|
||||
|
||||
public function testPresenterSeesOnlyTheScaleCount(): void
|
||||
public function testPresenterGetsScaleResultsFlaggedPrivate(): void
|
||||
{
|
||||
[, $token] = $this->privateScaleWithRatings();
|
||||
|
||||
@@ -203,8 +206,8 @@ class PrivateFeedbackTest extends TestCase
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
|
||||
$this->assertTrue($state['results']['private']);
|
||||
$this->assertSame([], $state['results']['buckets']);
|
||||
$this->assertNull($state['results']['average']);
|
||||
$this->assertCount(5, $state['results']['buckets']);
|
||||
$this->assertEqualsWithDelta(3.5, $state['results']['average'], 0.001);
|
||||
$this->assertSame(2, $state['results']['participants']);
|
||||
}
|
||||
|
||||
@@ -221,7 +224,7 @@ class PrivateFeedbackTest extends TestCase
|
||||
$this->assertNull($this->participantState($poll)['results']);
|
||||
}
|
||||
|
||||
public function testEmbedSeesOnlyTheScaleCount(): void
|
||||
public function testEmbedGetsScaleResultsFlaggedPrivate(): void
|
||||
{
|
||||
[$poll, , $slide] = $this->privateScaleWithRatings();
|
||||
$key = $this->pollsTable()->ensureEmbedKey($poll);
|
||||
@@ -230,8 +233,8 @@ class PrivateFeedbackTest extends TestCase
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
|
||||
$this->assertResponseOk();
|
||||
$this->assertSame([], $state['results']['buckets']);
|
||||
$this->assertNull($state['results']['average']);
|
||||
$this->assertTrue($state['results']['private']);
|
||||
$this->assertEqualsWithDelta(3.5, $state['results']['average'], 0.001);
|
||||
}
|
||||
|
||||
public function testAdminReadsScaleResults(): void
|
||||
|
||||
@@ -182,17 +182,18 @@ class ScaleCommentsTest extends TestCase
|
||||
$this->assertCount(2, $state['results']['comments']);
|
||||
}
|
||||
|
||||
public function testPrivateScaleNeverShowsComments(): void
|
||||
public function testPrivateScaleCommentsOnlyForTheStage(): void
|
||||
{
|
||||
[$poll, $token, $slide] = $this->scaleWithComments(['private' => true]);
|
||||
|
||||
// The presenter starts hidden but may show them, so the data is there.
|
||||
$results = $this->presenterResults($token);
|
||||
$this->assertSame([], $results['comments']);
|
||||
$this->assertResponseNotContains('Sehr');
|
||||
$this->assertTrue($results['private']);
|
||||
$this->assertCount(2, $results['comments']);
|
||||
|
||||
$key = $this->pollsTable()->ensureEmbedKey($poll);
|
||||
$this->get("/e/$key/{$slide->id}/state");
|
||||
$this->assertResponseNotContains('Sehr');
|
||||
$this->assertResponseContains('Sehr');
|
||||
|
||||
$this->get('/p/' . $poll->join_code . '/state');
|
||||
$this->assertResponseNotContains('Sehr');
|
||||
|
||||
Reference in new issue
Block a user