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
+132
-84
No files matched your search
@@ -167,23 +167,23 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
|
||||
ist die Berechtigung, siehe `Application::middleware()`) und erlauben Framing per CSP `frame-ancestors`
|
||||
(`EMBED_FRAME_ANCESTORS`); alle anderen Seiten bleiben `X-Frame-Options: SAMEORIGIN`.
|
||||
|
||||
- **Anonymes Feedback** (offene Frage mit Setting `private`, `Slide::isPrivate()`): Antworttexte erscheinen **nie** im
|
||||
Presenter-/Embed-JSON (`results.answers` leer, nur `participants`) und nie bei Teilnehmenden (keine `results`,
|
||||
unabhängig von `show_results_to_participants`). Lesen nur in der Verwaltung (`slides:answers`,
|
||||
`ResultsService::answers()`) und in der vollständigen Fassung des PDF-Exports.
|
||||
- **Internes Feedback** (Skala mit Setting `private`, ebenfalls `Slide::isPrivate()`): Presenter-/Embed-JSON enthält
|
||||
`buckets: []` und `average: null` (nur `participants`), Teilnehmende bekommen keine `results`. Verteilung und
|
||||
Durchschnitt nur in der Verwaltung (`slides:answers` → „Auswertung“, `ResultsService::scaleResults()`) und in der vollständigen Fassung des PDF-Exports.
|
||||
- **Anonymes / internes Feedback** (offene Frage bzw. Skala mit Setting `private`, `Slide::isPrivate()`): steuert den
|
||||
Schalter „Ergebnisse verbergen“ (H) im Presenter/Embed. Das JSON enthält die vollständigen Ergebnisse plus
|
||||
`results.private = true`; `initPresenter` verbirgt sie beim Wechsel auf eine solche Folie und zeigt stattdessen nur die
|
||||
Anzahl (`Results.privateSummary`). Einblenden gilt nur für diese Folie, die globale Wahl für normale Folien (`hideAll`)
|
||||
bleibt unberührt. Teilnehmende bekommen bei privaten Folien **nie** `results` (unabhängig von
|
||||
`show_results_to_participants`). Die Fassung des PDF-Exports ohne interne Inhalte entfernt sie per
|
||||
`ResultsService::withoutContents()`. Volle Ansicht in der Verwaltung (`slides:answers` → „Auswertung“).
|
||||
- **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 im Presenter-/Embed-State
|
||||
`results.comments` (Teilnehmende bekommen immer `[]`, `PollStateService::participantResults()`)
|
||||
(älteste zuerst, je `id`, `text`, `value` – `value` nur mit Setting `comment_ratings`, sonst `null`); `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,
|
||||
lesbar nur in der Auswertung (`ResultsService::comments()`) und in der vollständigen Fassung des PDF-Exports.
|
||||
vor/zurück/Pause, Zustand übersteht das Neu-Rendern beim Polling). Bei internem Feedback erscheinen sie erst,
|
||||
wenn der Presenter die Ergebnisse einblendet.
|
||||
|
||||
- **PDF-Export** (`/admin/{token}/export.pdf`, `admin:export`, `ReportService` + `PdfView`, Dompdf): Ergebnisse aller
|
||||
interaktiven Folien (Inhaltsfolien/YouTube fehlen). Standard ist die Fassung **ohne interne Inhalte**: private Folien
|
||||
(`Slide::isPrivate()`) erscheinen nur mit Teilnehmerzahl, wie im Presenter. `?internal=1` = vollständige Fassung inkl.
|
||||
(`Slide::isPrivate()`) erscheinen nur mit Teilnehmerzahl. `?internal=1` = vollständige Fassung inkl.
|
||||
anonymer Antworten, interner Skalen und Kommentar-Bewertungen (Dateiname `…-intern.pdf`, Hinweis „Vertraulich“ auf jeder
|
||||
Seite); ohne private Folien wird der Parameter ignoriert. Quiz/Reihenfolge folgen auch hier den Auflöse-Regeln
|
||||
(vor `finished` bzw. Schließen keine Zählungen/Lösung). Layout `templates/layout/pdf.php` ist eigenständig: keine
|
||||
|
||||
@@ -26,7 +26,8 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
||||
* counts and the participant's correctness (`order`) only once voting is closed.
|
||||
*
|
||||
* Q&A slides have their own participant view (`qa`, see qaState()), never `results`.
|
||||
* Private open questions (anonymous feedback) never show results to participants.
|
||||
* Private slides (anonymous/internal feedback) never show results to participants,
|
||||
* even though the presenter can show them on stage.
|
||||
*/
|
||||
class PollStateService
|
||||
{
|
||||
|
||||
@@ -90,14 +90,16 @@ class ReportService
|
||||
*/
|
||||
protected function resultsFor(Slide $slide, bool $includeInternal): array
|
||||
{
|
||||
// Public shape first: it never contains private data.
|
||||
$results = $this->results->forSlide($slide);
|
||||
$mayRead = !$slide->isPrivate() || $includeInternal;
|
||||
if (!$mayRead) {
|
||||
return ResultsService::withoutContents($results);
|
||||
}
|
||||
|
||||
if ($slide->type === Slide::TYPE_OPEN && $mayRead) {
|
||||
if ($slide->type === Slide::TYPE_OPEN) {
|
||||
$results['answers'] = $this->results->answers($slide);
|
||||
}
|
||||
if ($slide->type === Slide::TYPE_SCALE && $mayRead) {
|
||||
if ($slide->type === Slide::TYPE_SCALE) {
|
||||
// Ratings next to comments: complete version always, public one only with the setting.
|
||||
$showRatings = $includeInternal || (bool)$slide->setting('comment_ratings');
|
||||
$comments = [];
|
||||
|
||||
@@ -17,14 +17,14 @@ use Cake\ORM\Locator\LocatorAwareTrait;
|
||||
* (count = participants who named or upvoted the word, down = downvotes,
|
||||
* weight follows count)
|
||||
* - open: 'answers' => [['text', 'created']] newest first, 'private' (bool);
|
||||
* private (anonymous feedback): 'answers' is always empty, texts only via answers()
|
||||
* - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null,
|
||||
* 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool);
|
||||
* 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else [];
|
||||
* 'value' is null unless the setting comment_ratings is on;
|
||||
* presentation only, emptied for participants in PollStateService);
|
||||
* private (internal feedback): 'buckets' and 'comments' are always empty and 'average' null,
|
||||
* ratings and comments only via scaleResults() / comments()
|
||||
* open/scale with 'private' (anonymous/internal feedback): contents are included for the
|
||||
* presenter/embed, which start with the results hidden and may show them on demand;
|
||||
* participants never get results of these slides, the public PDF strips them (withoutContents())
|
||||
* - quiz: 'phase' (ready|running|finished), 'timeLimit' (s, 0 = manual), 'remaining' (s|null),
|
||||
* 'revealed' (bool), 'options' => [['id', 'label']] while not finished;
|
||||
* once finished additionally per option 'count', 'percent', 'correct' (bool)
|
||||
@@ -277,13 +277,12 @@ class ResultsService
|
||||
{
|
||||
return [
|
||||
'private' => $slide->isPrivate(),
|
||||
'answers' => $slide->isPrivate() ? [] : $this->answers($slide, self::MAX_ANSWERS),
|
||||
'answers' => $this->answers($slide, self::MAX_ANSWERS),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Texts of an open question, newest first – also of private slides,
|
||||
* so only for the admin area (never for the presenter screen or participants).
|
||||
* Texts of an open question, newest first.
|
||||
*
|
||||
* @param \App\Model\Entity\Slide $slide Open question
|
||||
* @param int|null $limit Max. answers, null = all
|
||||
@@ -313,7 +312,6 @@ class ResultsService
|
||||
*/
|
||||
protected function scale(Slide $slide): array
|
||||
{
|
||||
if (!$slide->isPrivate()) {
|
||||
$showRatings = (bool)$slide->setting('comment_ratings');
|
||||
$comments = [];
|
||||
foreach ($slide->hasComments() ? $this->comments($slide, self::MAX_ANSWERS) : [] as $comment) {
|
||||
@@ -324,24 +322,33 @@ class ResultsService
|
||||
];
|
||||
}
|
||||
|
||||
return $this->scaleResults($slide) + ['private' => false, 'comments' => $comments];
|
||||
}
|
||||
|
||||
return [
|
||||
'buckets' => [],
|
||||
'average' => null,
|
||||
'min' => (int)$slide->setting('scale_min'),
|
||||
'max' => (int)$slide->setting('scale_max'),
|
||||
'minLabel' => (string)$slide->setting('min_label'),
|
||||
'maxLabel' => (string)$slide->setting('max_label'),
|
||||
'private' => true,
|
||||
'comments' => [],
|
||||
];
|
||||
return $this->scaleResults($slide) + ['private' => $slide->isPrivate(), 'comments' => $comments];
|
||||
}
|
||||
|
||||
/**
|
||||
* Comments of a scale with their rating, oldest first – also of private slides,
|
||||
* so the unfiltered call is only for the admin area.
|
||||
* Results of a private slide without its contents: only type, participants and the scale range.
|
||||
* Used where internal feedback must not appear (participants, public PDF export).
|
||||
*
|
||||
* @param array<string, mixed> $results Result of forSlide()
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function withoutContents(array $results): array
|
||||
{
|
||||
if (isset($results['answers'])) {
|
||||
$results['answers'] = [];
|
||||
}
|
||||
if (isset($results['buckets'])) {
|
||||
$results['buckets'] = [];
|
||||
$results['average'] = null;
|
||||
$results['comments'] = [];
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comments of a scale with their rating, oldest first; the unfiltered call
|
||||
* (ratings regardless of comment_ratings) is only for the admin area.
|
||||
*
|
||||
* @param \App\Model\Entity\Slide $slide Scale slide
|
||||
* @param int|null $limit Max. comments (the newest ones), null = all
|
||||
@@ -371,8 +378,7 @@ class ResultsService
|
||||
}
|
||||
|
||||
/**
|
||||
* Distribution and average of a scale – also of private slides,
|
||||
* so only for the admin area (never for the presenter screen or participants).
|
||||
* Distribution and average of a scale.
|
||||
*
|
||||
* @param \App\Model\Entity\Slide $slide Scale slide
|
||||
* @return array{buckets: list<array{value: int, count: int, percent: float|int}>, average: float|null, min: int, max: int, minLabel: string, maxLabel: string}
|
||||
|
||||
@@ -101,7 +101,7 @@ $hasInternal = array_filter($slides, fn($slide) => $slide->isInteractive() && $s
|
||||
<span class="muted">· <?= __('Abstimmung geschlossen, aufgelöst') ?></span>
|
||||
<?php elseif (!$slide->is_voting_open) : ?><span class="muted">· <?= __('Abstimmung geschlossen') ?></span><?php endif; ?>
|
||||
<?php if ($slide->hasComments()) : ?><span class="badge" title="<?= __('Teilnehmende können einen Kommentar abgeben') ?>">💬 <?= __('Kommentare') ?></span><?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?><span class="badge" title="<?= __('Antworten werden nicht öffentlich angezeigt') ?>">🔒 <?= $slide->type === 'scale' ? __('intern') : __('anonym') ?></span><?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?><span class="badge" title="<?= __('In der Präsentation zunächst verborgen, für Teilnehmende nie sichtbar') ?>">🔒 <?= $slide->type === 'scale' ? __('intern') : __('anonym') ?></span><?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<a class="slide-item__title" href="<?= $this->Url->build($url('slides:edit', ['id' => $slide->id])) ?>"><?= h($slide->question) ?></a>
|
||||
|
||||
@@ -234,7 +234,7 @@ $countdown = function (?int $remaining): string {
|
||||
placeholder="<?= __('Deine Antwort …') ?>"></textarea>
|
||||
<?php if ($slide->isPrivate()) : ?>
|
||||
<p class="hint private-hint" id="private-hint">
|
||||
🔒 <?= __('Anonymes Feedback: Deine Antwort wird nicht öffentlich angezeigt und nicht mit deinem Namen gespeichert.') ?>
|
||||
🔒 <?= __('Anonymes Feedback: Die Antworten erscheinen nicht automatisch in der Präsentation, und deine Antwort wird nicht mit deinem Namen gespeichert.') ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -258,7 +258,7 @@ $countdown = function (?int $remaining): string {
|
||||
<?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?>
|
||||
<p class="hint private-hint" id="private-hint">
|
||||
🔒 <?= __('Internes Feedback: Das Ergebnis wird nicht öffentlich angezeigt und deine Bewertung nicht mit deinem Namen gespeichert.') ?>
|
||||
🔒 <?= __('Internes Feedback: Das Ergebnis erscheint nicht automatisch in der Präsentation, und deine Bewertung wird nicht mit deinem Namen gespeichert.') ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* All answers of an open question or the ratings of a scale – the only place where
|
||||
* anonymous/internal feedback (private slides) can be read, besides the complete version of the PDF export.
|
||||
* All answers of an open question or the ratings of a scale, including anonymous/internal
|
||||
* feedback (private slides).
|
||||
*
|
||||
* @var \App\View\AppView $this
|
||||
* @var \App\Model\Entity\Poll $poll
|
||||
@@ -32,8 +32,8 @@ $count = $scale !== null ? array_sum(array_column($scale['buckets'], 'count')) :
|
||||
<?php endif; ?>
|
||||
<?php if ($slide->isPrivate()) : ?>
|
||||
<p class="hint"><?= $scale !== null
|
||||
? __('Dieses Ergebnis wird weder in der Präsentation noch den Teilnehmenden angezeigt.')
|
||||
: __('Diese Antworten werden weder in der Präsentation noch den Teilnehmenden angezeigt.') ?></p>
|
||||
? __('Dieses Ergebnis ist in der Präsentation zunächst verborgen und wird den Teilnehmenden nie angezeigt.')
|
||||
: __('Diese Antworten sind in der Präsentation zunächst verborgen und werden den Teilnehmenden nie angezeigt.') ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($scale !== null) : ?>
|
||||
|
||||
@@ -135,7 +135,7 @@ $optionsError = $slide->getError('options_text');
|
||||
'label' => __('Anonymes Feedback: Antworten nicht öffentlich anzeigen'),
|
||||
'checked' => (bool)$settings['private'],
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Präsentation und Teilnehmende sehen nur, wie viele Antworten eingegangen sind. Die Texte siehst nur du hier in der Verwaltung (und in der vollständigen Fassung des PDF-Exports).') ?></p>
|
||||
<p class="hint"><?= __('Die Präsentation zeigt zunächst nur, wie viele Antworten eingegangen sind. Mit „Ergebnisse zeigen“ (Taste H) kannst du die Texte bei Bedarf einblenden. Teilnehmende sehen sie nie, im PDF-Export stehen sie nur in der vollständigen Fassung.') ?></p>
|
||||
<?php elseif ($slide->type === 'wordcloud') : ?>
|
||||
<?= $this->Form->control('settings.allow_upvotes', [
|
||||
'type' => 'checkbox',
|
||||
@@ -171,7 +171,7 @@ $optionsError = $slide->getError('options_text');
|
||||
'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'),
|
||||
'checked' => (bool)$settings['comments'],
|
||||
]) ?>
|
||||
<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>
|
||||
<p class="hint"><?= __('Die Kommentare laufen in der Präsentation nacheinander durch (nicht bei den Teilnehmenden). Bei internem Feedback erst, wenn du die Ergebnisse einblendest.') ?></p>
|
||||
<?= $this->Form->control('settings.comment_ratings', [
|
||||
'type' => 'checkbox',
|
||||
'label' => __('Bewertung beim Kommentar in der Präsentation anzeigen'),
|
||||
@@ -182,7 +182,7 @@ $optionsError = $slide->getError('options_text');
|
||||
'label' => __('Internes Feedback: Ergebnis nicht öffentlich anzeigen'),
|
||||
'checked' => (bool)$settings['private'],
|
||||
]) ?>
|
||||
<p class="hint"><?= __('Präsentation und Teilnehmende sehen nur, wie viele Bewertungen eingegangen sind. Verteilung, Durchschnitt und Kommentare siehst nur du hier in der Verwaltung (und in der vollständigen Fassung des PDF-Exports).') ?></p>
|
||||
<p class="hint"><?= __('Die Präsentation zeigt zunächst nur, wie viele Bewertungen eingegangen sind. Mit „Ergebnisse zeigen“ (Taste H) kannst du Verteilung, Durchschnitt und Kommentare bei Bedarf einblenden. Teilnehmende sehen sie nie, im PDF-Export stehen sie nur in der vollständigen Fassung.') ?></p>
|
||||
<?php elseif ($slide->type === 'quiz') :
|
||||
$quizError = $slide->getError('quiz_options');
|
||||
$rows = $quizOptions;
|
||||
|
||||
@@ -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');
|
||||
|
||||
+55
-20
@@ -453,16 +453,25 @@
|
||||
}));
|
||||
},
|
||||
|
||||
scale: function (results) {
|
||||
if (results.private) {
|
||||
// Internal feedback: the ratings never reach the stage, only the count.
|
||||
/**
|
||||
* Placeholder for a private slide (anonymous/internal feedback) while its results
|
||||
* are hidden on stage: only the count, the presenter can show the rest with H.
|
||||
*/
|
||||
privateSummary: function (results) {
|
||||
var n = results.participants;
|
||||
var noun = results.type === 'scale'
|
||||
? (n === 1 ? 'Bewertung' : 'Bewertungen')
|
||||
: (n === 1 ? 'anonyme Antwort' : 'anonyme Antworten');
|
||||
return el('div', { class: 'private-summary' }, [
|
||||
el('p', { class: 'private-summary__count', text: String(n) }),
|
||||
el('p', { text: (n === 1 ? 'Bewertung' : 'Bewertungen') + ' eingegangen' }),
|
||||
el('p', { class: 'private-summary__hint', text: '🔒 Ergebnis wird nicht öffentlich angezeigt.' })
|
||||
el('p', { text: noun + ' eingegangen' }),
|
||||
el('p', { class: 'private-summary__hint', text: results.type === 'scale'
|
||||
? '🔒 Internes Feedback – Ergebnis verborgen.'
|
||||
: '🔒 Anonymes Feedback – Antworten verborgen.' })
|
||||
]);
|
||||
}
|
||||
},
|
||||
|
||||
scale: function (results) {
|
||||
var max = Math.max.apply(null, results.buckets.map(function (b) { return b.count; }).concat([1]));
|
||||
var total = results.buckets.reduce(function (sum, b) { return sum + b.count; }, 0);
|
||||
var hasAverage = results.average !== null;
|
||||
@@ -688,15 +697,6 @@
|
||||
},
|
||||
|
||||
open: function (results) {
|
||||
if (results.private) {
|
||||
// Anonymous feedback: the texts never reach the stage, only the count.
|
||||
var n = results.participants;
|
||||
return el('div', { class: 'private-summary' }, [
|
||||
el('p', { class: 'private-summary__count', text: String(n) }),
|
||||
el('p', { text: (n === 1 ? 'anonyme Antwort' : 'anonyme Antworten') + ' eingegangen' }),
|
||||
el('p', { class: 'private-summary__hint', text: '🔒 Antworten werden nicht öffentlich angezeigt.' })
|
||||
]);
|
||||
}
|
||||
return el('ul', { class: 'answers' }, results.answers.map(function (answer) {
|
||||
return el('li', { class: 'answer', text: answer.text });
|
||||
}));
|
||||
@@ -968,7 +968,11 @@
|
||||
}
|
||||
};
|
||||
var last = '';
|
||||
// hideAll: the presenter's choice for normal slides (kept across slides).
|
||||
// hideResults: what applies to the current slide - private slides start hidden.
|
||||
var hideAll = false;
|
||||
var hideResults = false;
|
||||
var hideSlideId = null;
|
||||
var state = null;
|
||||
var mediaKey = '';
|
||||
|
||||
@@ -1057,13 +1061,38 @@
|
||||
? count + (count === 1 ? ' Frage' : ' Fragen')
|
||||
: count + ' ' + (count === 1 ? 'Antwort' : 'Antworten')));
|
||||
|
||||
if (slide.id !== hideSlideId) {
|
||||
hideSlideId = slide.id;
|
||||
hideResults = isPrivate() || hideAll;
|
||||
hideLabel();
|
||||
}
|
||||
renderResults();
|
||||
Countdown.start();
|
||||
}
|
||||
|
||||
function isPrivate() {
|
||||
return !!(state && state.slide && state.slide.isInteractive && state.results && state.results.private);
|
||||
}
|
||||
|
||||
function renderResults() {
|
||||
var container = q('[data-results]');
|
||||
container.classList.toggle('is-hidden', hideResults);
|
||||
Results.render(container, slide.isInteractive ? state.results : null, {
|
||||
var slide = state.slide;
|
||||
// Hidden private slides show how many answered instead of an empty stage.
|
||||
var summary = hideResults && isPrivate();
|
||||
container.classList.toggle('is-hidden', hideResults && !summary);
|
||||
if (summary) {
|
||||
container.textContent = '';
|
||||
container.appendChild(Results.privateSummary(state.results));
|
||||
return;
|
||||
}
|
||||
Results.render(container, slide && slide.isInteractive ? state.results : null, {
|
||||
onStage: function (stage) { control('stage', { stage: stage }); },
|
||||
onQuestion: function (step) { control('question', { step: step }); }
|
||||
});
|
||||
Countdown.start();
|
||||
}
|
||||
|
||||
function hideLabel() {
|
||||
setText('[data-hide-results] [data-label]', hideResults ? 'Ergebnisse zeigen' : 'Ergebnisse verbergen');
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
@@ -1083,8 +1112,14 @@
|
||||
|
||||
function toggleHide() {
|
||||
hideResults = !hideResults;
|
||||
q('[data-results]').classList.toggle('is-hidden', hideResults);
|
||||
setText('[data-hide-results] [data-label]', hideResults ? 'Ergebnisse zeigen' : 'Ergebnisse verbergen');
|
||||
// Showing a private slide is a decision for this slide only.
|
||||
if (!isPrivate()) {
|
||||
hideAll = hideResults;
|
||||
}
|
||||
hideLabel();
|
||||
if (state) {
|
||||
renderResults();
|
||||
}
|
||||
}
|
||||
q('[data-hide-results]').addEventListener('click', toggleHide);
|
||||
|
||||
|
||||
Reference in new issue
Block a user