Show scale comments only in the presentation
Participants still see distribution and average (if enabled), but the comments are emptied in their state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b879ca177
commit
d6166bd9d9
5 files changed
+42
-12
No files matched your search
@@ -173,7 +173,8 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
|
|||||||
`buckets: []` und `average: null` (nur `participants`), Teilnehmende bekommen keine `results`. Verteilung und
|
`buckets: []` und `average: null` (nur `participants`), Teilnehmende bekommen keine `results`. Verteilung und
|
||||||
Durchschnitt nur in der Verwaltung (`slides:answers` → „Auswertung“, `ResultsService::scaleResults()`) und im CSV-Export.
|
Durchschnitt nur in der Verwaltung (`slides:answers` → „Auswertung“, `ResultsService::scaleResults()`) und im CSV-Export.
|
||||||
- **Skala-Kommentare** (Setting `comments`, `Slide::hasComments()`): optionales Feld `comment`, gespeichert als `text_value`
|
- **Skala-Kommentare** (Setting `comments`, `Slide::hasComments()`): optionales Feld `comment`, gespeichert als `text_value`
|
||||||
in derselben Zeile wie `numeric_value` (ohne Setting wird es ignoriert). Öffentliche Skalen liefern `results.comments`
|
in derselben Zeile wie `numeric_value` (ohne Setting wird es ignoriert). Öffentliche Skalen liefern im Presenter-/Embed-State
|
||||||
|
`results.comments` (Teilnehmende bekommen immer `[]`, `PollStateService::participantResults()`)
|
||||||
(älteste zuerst, je `id`, `text`, `value`); `Comments` in `plenario.js` blättert sie automatisch durch („Kommentar X von N“,
|
(älteste zuerst, je `id`, `text`, `value`); `Comments` in `plenario.js` blättert sie automatisch durch („Kommentar X von N“,
|
||||||
vor/zurück/Pause, Zustand übersteht das Neu-Rendern beim Polling). Bei internem Feedback bleibt `comments` leer,
|
vor/zurück/Pause, Zustand übersteht das Neu-Rendern beim Polling). Bei internem Feedback bleibt `comments` leer,
|
||||||
lesbar nur in der Auswertung (`ResultsService::comments()`) und im CSV-Export.
|
lesbar nur in der Auswertung (`ResultsService::comments()`) und im CSV-Export.
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class PollStateService
|
|||||||
$slide?->modified?->toUnixString() ?? 0,
|
$slide?->modified?->toUnixString() ?? 0,
|
||||||
]),
|
]),
|
||||||
'slide' => $showResults ? $this->slidePayload($slide) : null,
|
'slide' => $showResults ? $this->slidePayload($slide) : null,
|
||||||
'results' => $showResults ? $this->results->forSlide($slide) : null,
|
'results' => $showResults ? $this->participantResults($slide) : null,
|
||||||
'words' => $words,
|
'words' => $words,
|
||||||
'quiz' => $quiz,
|
'quiz' => $quiz,
|
||||||
'qa' => $qa,
|
'qa' => $qa,
|
||||||
@@ -195,6 +195,22 @@ class PollStateService
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Results as participants see them: scale comments are for the presentation only.
|
||||||
|
*
|
||||||
|
* @param \App\Model\Entity\Slide $slide Current slide
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
protected function participantResults(Slide $slide): array
|
||||||
|
{
|
||||||
|
$results = $this->results->forSlide($slide);
|
||||||
|
if (isset($results['comments'])) {
|
||||||
|
$results['comments'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ordering progress of one participant. Own answer and correctness only once
|
* Ordering progress of one participant. Own answer and correctness only once
|
||||||
* revealed (voting closed); before that the state must not hint at the solution.
|
* revealed (voting closed); before that the state must not hint at the solution.
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
|||||||
* private (anonymous feedback): 'answers' is always empty, texts only via answers()
|
* private (anonymous feedback): 'answers' is always empty, texts only via answers()
|
||||||
* - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null,
|
* - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null,
|
||||||
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool);
|
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool);
|
||||||
* 'comments' => [['id', 'text', 'value']] oldest first (only with the comment field, else []);
|
* 'comments' => [['id', 'text', 'value']] oldest first (only with the comment field, else [];
|
||||||
|
* presentation only, emptied for participants in PollStateService);
|
||||||
* private (internal feedback): 'buckets' and 'comments' are always empty and 'average' null,
|
* private (internal feedback): 'buckets' and 'comments' are always empty and 'average' null,
|
||||||
* ratings and comments only via scaleResults() / comments()
|
* ratings and comments only via scaleResults() / comments()
|
||||||
* - quiz: 'phase' (ready|running|finished), 'timeLimit' (s, 0 = manual), 'remaining' (s|null),
|
* - quiz: 'phase' (ready|running|finished), 'timeLimit' (s, 0 = manual), 'remaining' (s|null),
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ $optionsError = $slide->getError('options_text');
|
|||||||
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'),
|
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'),
|
||||||
'checked' => (bool)$settings['comments'],
|
'checked' => (bool)$settings['comments'],
|
||||||
]) ?>
|
]) ?>
|
||||||
<p class="hint"><?= __('Die Kommentare laufen bei den Ergebnissen nacheinander durch – außer bei internem Feedback, dann siehst du sie nur in der Auswertung.') ?></p>
|
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden). Bei internem Feedback siehst du sie nur in der Auswertung.') ?></p>
|
||||||
<?= $this->Form->control('settings.private', [
|
<?= $this->Form->control('settings.private', [
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'label' => __('Internes Feedback: Ergebnis nicht öffentlich anzeigen'),
|
'label' => __('Internes Feedback: Ergebnis nicht öffentlich anzeigen'),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use Cake\TestSuite\IntegrationTestTrait;
|
|||||||
use Cake\TestSuite\TestCase;
|
use Cake\TestSuite\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale slides with an optional comment field: comments rotate on the results unless the scale is private.
|
* Scale slides with an optional comment field: comments rotate in the presentation unless the scale is private.
|
||||||
*/
|
*/
|
||||||
class ScaleCommentsTest extends TestCase
|
class ScaleCommentsTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -144,20 +144,32 @@ class ScaleCommentsTest extends TestCase
|
|||||||
$this->assertSame([4, 3], array_column($results['comments'], 'value'));
|
$this->assertSame([4, 3], array_column($results['comments'], 'value'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParticipantsSeeCommentsOnlyWithPublicResults(): void
|
public function testParticipantsNeverSeeComments(): void
|
||||||
{
|
{
|
||||||
[$poll] = $this->scaleWithComments();
|
[$poll] = $this->scaleWithComments();
|
||||||
// Participant "a" has already rated.
|
$this->assertTrue($poll->show_results_to_participants);
|
||||||
|
// Participant "a" has already rated and sees the results – but not the comments.
|
||||||
$this->cookie('plenario_pid', str_repeat('a', 32));
|
$this->cookie('plenario_pid', str_repeat('a', 32));
|
||||||
|
|
||||||
$this->get('/p/' . $poll->join_code . '/state');
|
$this->get('/p/' . $poll->join_code . '/state');
|
||||||
$state = json_decode((string)$this->_response->getBody(), true);
|
$state = json_decode((string)$this->_response->getBody(), true);
|
||||||
$this->assertCount(2, $state['results']['comments']);
|
$this->assertNotEmpty($state['results']['buckets']);
|
||||||
|
$this->assertSame([], $state['results']['comments']);
|
||||||
|
$this->assertResponseNotContains('Zu lang');
|
||||||
|
|
||||||
$poll->show_results_to_participants = false;
|
$this->get('/p/' . $poll->join_code);
|
||||||
$this->pollsTable()->saveOrFail($poll);
|
$this->assertResponseNotContains('Zu lang');
|
||||||
$this->get('/p/' . $poll->join_code . '/state');
|
}
|
||||||
$this->assertNull(json_decode((string)$this->_response->getBody(), true)['results']);
|
|
||||||
|
public function testEmbedShowsComments(): void
|
||||||
|
{
|
||||||
|
[$poll, , $slide] = $this->scaleWithComments();
|
||||||
|
$key = $this->pollsTable()->ensureEmbedKey($poll);
|
||||||
|
|
||||||
|
$this->get("/e/$key/{$slide->id}/state");
|
||||||
|
$state = json_decode((string)$this->_response->getBody(), true);
|
||||||
|
|
||||||
|
$this->assertCount(2, $state['results']['comments']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrivateScaleNeverShowsComments(): void
|
public function testPrivateScaleNeverShowsComments(): void
|
||||||
|
|||||||
Reference in new issue
Block a user