From dbac9e93c77fe1b2cbe30f64905c09ab0a724f40 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Sat, 21 Nov 2026 12:58:01 +0100 Subject: [PATCH] Allow a comment without a rating on scales instead of "Keine Angabe" With the comment field enabled, scales and star ratings accept a comment alone. It counts as taking part but not in the average or the distribution; the number is shown separately. The explicit skip button and its setting are removed again. Co-Authored-By: Claude Sonnet 5.5 --- docs/slide-types.md | 12 +++--- src/Controller/ParticipateController.php | 7 +--- src/Model/Entity/Slide.php | 4 +- src/Model/Table/SlidesTable.php | 1 - src/Service/ResultsService.php | 24 +++++------ src/Service/VoteService.php | 34 +++++---------- templates/Admin/export.php | 4 +- templates/Participate/view.php | 14 ++----- templates/Slides/answers.php | 4 +- templates/Slides/form.php | 8 +--- .../Controller/ParticipateControllerTest.php | 19 +++------ tests/TestCase/Service/VoteServiceTest.php | 41 ++++++++++++------- webroot/css/plenario.css | 1 - webroot/js/plenario.js | 17 ++++---- 14 files changed, 85 insertions(+), 105 deletions(-) diff --git a/docs/slide-types.md b/docs/slide-types.md index bbadc75..a1117fa 100644 --- a/docs/slide-types.md +++ b/docs/slide-types.md @@ -146,11 +146,13 @@ geändert wird es nur über die Presenter-Steuerung (`SlideControlService`) bzw. (`Results.scaleLayout()` / `Results.donut()`). Setting `scale_view` (`Slide::SCALE_VIEWS`: `both` | `average` | `chart`, Dropdown im Formular) zeigt nur einen Teil, dann zentriert; im JSON `results.view`, die Daten bleiben vollständig. Gilt nur für Presenter/Embed, Auswertung und PDF zeigen immer beides. -- **Keine Angabe** (Setting `allow_skip`, Standard aus): zweiter Button neben „Absenden“ (`skip=1`, `formnovalidate`). `VoteService::scaleRows()` - speichert eine Zeile **ohne** `numeric_value` und ohne Kommentar: zählt als Teilnahme (einmal pro Person, `countParticipants`), geht aber nicht in - Verteilung und Durchschnitt ein. `ResultsService::scaleResults()` liefert die Zahl separat als `skipped` (Bühne: „· N× keine Angabe“ unter der - Bewertungszahl, Auswertung, PDF); private Folien strippen sie wie den Rest (`withoutContents()`). Ein Kommentar nachträglich geht nicht - (`editText()` lehnt ab, `VoteService::hasSkipped()` blendet das Formular aus). Tests: `VoteServiceTest`, `ParticipateControllerTest`. +- **Nur Kommentar ohne Bewertung** (Skala/Sterne mit Setting `comments`): die Bewertung ist dann nicht mehr Pflicht (die Radios sind nicht `required`), + ein nicht leerer Kommentar genügt. `VoteService::scaleRows()` speichert eine Zeile **ohne** `numeric_value`: zählt als Teilnahme (einmal pro Person), + geht aber nicht in Verteilung und Durchschnitt ein. Weder Bewertung noch Kommentar = Fehler, es gibt keinen leeren „Überspringen“-Knopf. + `ResultsService::scaleResults()` liefert die Zahl als `commentOnly` (Bühne: „· N× nur Kommentar“, Auswertung, PDF; private Folien strippen sie + mit `withoutContents()`). Der Kommentar läuft wie die anderen durch, `value` ist `null` (mit `comment_ratings` zeigt die Bühne „Ohne Bewertung“, damit + die Box gleich hoch bleibt). Nachträglich bearbeiten geht, aber der Kommentar darf dann nicht leer werden (`editText()`). Bei Auswahlfolien gibt es das + bewusst nicht (der Kommentar hängt an der ersten Optionszeile). Tests: `VoteServiceTest`, `ParticipateControllerTest`. - **Enthaltung bei Auswahlfolien:** kein eigenes Feature, sondern eine normale Option (zählt in Prozenten mit, wie bei Vereinsabstimmungen üblich). Im Folienformular fügt der Button „Option ‚Enthaltung‘ hinzufügen“ (`data-add-option`, `initAddOption()` in `plenario.js`, idempotent, nur mit JS sichtbar) die Zeile ein. - **Antwort nachträglich bearbeiten** (gegen Tippfehler, `VoteService::hasEditableText()`): Antwort einer offenen Frage diff --git a/src/Controller/ParticipateController.php b/src/Controller/ParticipateController.php index 8eb2739..458ee28 100644 --- a/src/Controller/ParticipateController.php +++ b/src/Controller/ParticipateController.php @@ -93,14 +93,11 @@ class ParticipateController extends AppController $slide = $poll->is_active ? $stateService->currentSlide($poll) : null; $participantHash = $this->participantHash($poll); $state = $stateService->forParticipant($poll, $participantHash, $slide); - $voteService = new VoteService(); $ownText = $slide !== null && VoteService::hasEditableText($slide) && $state['hasResponded'] - ? $voteService->ownText($slide, $participantHash) + ? (new VoteService())->ownText($slide, $participantHash) : null; - // "Keine Angabe" has no rating to comment on - $skipped = $slide !== null && $state['hasResponded'] && $voteService->hasSkipped($slide, $participantHash); - $this->set(compact('poll', 'slide', 'state', 'participantHash', 'ownText', 'skipped')); + $this->set(compact('poll', 'slide', 'state', 'participantHash', 'ownText')); $this->setPollInterval(); } diff --git a/src/Model/Entity/Slide.php b/src/Model/Entity/Slide.php index 515e338..f5d241e 100644 --- a/src/Model/Entity/Slide.php +++ b/src/Model/Entity/Slide.php @@ -123,7 +123,7 @@ class Slide extends Entity // private: internal feedback, ratings only visible in the admin area (never on the stage) // comments: optional comment field, comments rotate in the presentation (unless private) // comment_ratings: show the rating next to each comment in the presentation - // allow_skip: participants may answer "Keine Angabe" (row without numeric_value, not part of the average) + // with comments, participants may also send only a comment (row without numeric_value, not part of the average) // (time per comment depends on its length, see Comments.delay() in plenario.js) // style: numbers or stars (SCALE_*), stars always start at scale_min = 1 // scale_view: parts of the result shown in the presentation (presenter/embed, SCALE_VIEWS); @@ -131,7 +131,7 @@ class Slide extends Entity self::TYPE_SCALE => [ 'style' => self::SCALE_NUMBERS, 'scale_min' => 1, 'scale_max' => 5, 'min_label' => '', 'max_label' => '', 'private' => false, - 'comments' => false, 'comment_ratings' => false, 'allow_skip' => false, + 'comments' => false, 'comment_ratings' => false, 'scale_view' => self::SCALE_VIEW_BOTH, 'time_limit' => 0, ], diff --git a/src/Model/Table/SlidesTable.php b/src/Model/Table/SlidesTable.php index 9038681..c45bc25 100644 --- a/src/Model/Table/SlidesTable.php +++ b/src/Model/Table/SlidesTable.php @@ -177,7 +177,6 @@ class SlidesTable extends Table $settings['private'] = filter_var($input['private'] ?? false, FILTER_VALIDATE_BOOLEAN); $settings['comments'] = filter_var($input['comments'] ?? false, FILTER_VALIDATE_BOOLEAN); $settings['comment_ratings'] = filter_var($input['comment_ratings'] ?? false, FILTER_VALIDATE_BOOLEAN); - $settings['allow_skip'] = filter_var($input['allow_skip'] ?? false, FILTER_VALIDATE_BOOLEAN); $view = $input['scale_view'] ?? null; $settings['scale_view'] = in_array($view, Slide::SCALE_VIEWS, true) ? $view : Slide::SCALE_VIEW_BOTH; break; diff --git a/src/Service/ResultsService.php b/src/Service/ResultsService.php index 27cb9b1..372ff0b 100644 --- a/src/Service/ResultsService.php +++ b/src/Service/ResultsService.php @@ -21,7 +21,7 @@ use Cake\ORM\Locator\LocatorAwareTrait; * - open: 'answers' => [['text', 'created']] newest first, 'private' (bool); * - scale: 'buckets' => [['value', 'count', 'percent']], 'average' => float|null, * 'min', 'max', 'minLabel', 'maxLabel', 'private' (bool), 'stars' (bool: star rating, min = 1); - * 'skipped' (int: answers "Keine Angabe", setting allow_skip; not part of buckets/average); + * 'commentOnly' (int: participants who sent only a comment without a rating, not part of buckets/average); * 'comments' => [['id', 'text', 'value' (int|null)]] oldest first (only with the comment field, else []; * 'value' is null unless the setting comment_ratings is on; * 'view' (both|average|chart): parts shown in the presentation (setting scale_view, @@ -487,7 +487,7 @@ class ResultsService if (isset($results['buckets'])) { $results['buckets'] = []; $results['average'] = null; - $results['skipped'] = 0; + $results['commentOnly'] = 0; $results['comments'] = []; } @@ -504,13 +504,15 @@ class ResultsService */ public function comments(Slide $slide, ?int $limit = null): array { - // Scale: the rating row carries the comment. Choice: the comment sits in the first of the - // participant's rows, which always has an option. - $answered = $slide->type === Slide::TYPE_CHOICE ? 'slide_option_id IS NOT' : 'numeric_value IS NOT'; + // Scale: the rating row carries the comment (no rating = comment only). Choice: the comment + // sits in the first of the participant's rows, which always has an option. $query = $this->Responses->find() ->select(['id', 'text_value', 'numeric_value', 'created']) - ->where(['slide_id' => $slide->id, 'text_value IS NOT' => null, $answered => null]) + ->where(['slide_id' => $slide->id, 'text_value IS NOT' => null]) ->orderBy(['id' => 'DESC']); + if ($slide->type === Slide::TYPE_CHOICE) { + $query->where(['slide_option_id IS NOT' => null]); + } if ($limit !== null) { $query->limit($limit); } @@ -532,7 +534,7 @@ class ResultsService * Distribution and average of a scale. * * @param \App\Model\Entity\Slide $slide Scale slide - * @return array{buckets: list, average: float|null, min: int, max: int, minLabel: string, maxLabel: string, stars: bool, skipped: int} + * @return array{buckets: list, average: float|null, min: int, max: int, minLabel: string, maxLabel: string, stars: bool, commentOnly: int} */ public function scaleResults(Slide $slide): array { @@ -547,10 +549,8 @@ class ResultsService ->combine('numeric_value', 'n') ->toArray(); - // "Keine Angabe": taking part without a rating, never part of the average or the distribution - $skipped = $slide->setting('allow_skip') - ? $this->Responses->find()->where(['slide_id' => $slide->id, 'numeric_value IS' => null])->count() - : 0; + // Comment only: taking part without a rating, never part of the average or the distribution + $commentOnly = $this->Responses->find()->where(['slide_id' => $slide->id, 'numeric_value IS' => null])->count(); $total = 0; $sum = 0; @@ -576,7 +576,7 @@ class ResultsService 'minLabel' => (string)$slide->setting('min_label'), 'maxLabel' => (string)$slide->setting('max_label'), 'stars' => $slide->isStarRating(), - 'skipped' => $skipped, + 'commentOnly' => $commentOnly, ]; } } diff --git a/src/Service/VoteService.php b/src/Service/VoteService.php index b921be0..5aaa9e2 100644 --- a/src/Service/VoteService.php +++ b/src/Service/VoteService.php @@ -179,8 +179,9 @@ class VoteService default => __('Bitte gib zuerst deine Bewertung ab.'), }); } - if ($slide->type === Slide::TYPE_SCALE && $row->numeric_value === null) { - throw new VoteException(__('Zu „Keine Angabe“ gibt es keinen Kommentar.')); + if ($slide->type === Slide::TYPE_SCALE && $row->numeric_value === null && $text === null) { + // Without a rating the comment is the whole answer. + throw new VoteException(__('Ohne Bewertung darf der Kommentar nicht leer sein.')); } $row->text_value = $text; $this->Responses->saveOrFail($row); @@ -206,22 +207,6 @@ class VoteService return $row['text_value'] ?? null; } - /** - * Whether the participant answered a scale with "Keine Angabe" (a row without rating). - * - * @param \App\Model\Entity\Slide $slide Slide - * @param string $participantHash Participant hash - * @return bool - */ - public function hasSkipped(Slide $slide, string $participantHash): bool - { - return $slide->type === Slide::TYPE_SCALE && $this->Responses->exists([ - 'slide_id' => $slide->id, - 'participant_hash' => $participantHash, - 'numeric_value IS' => null, - ]); - } - /** * Poll active, slide live and interactive, voting open. * @@ -701,13 +686,16 @@ class VoteService */ protected function scaleRows(Slide $slide, array $data): array { - if (self::stringField($data, 'skip') === '1') { - if (!$slide->setting('allow_skip')) { - throw new VoteException(__('„Keine Angabe“ ist bei dieser Frage nicht möglich.')); + if (self::stringField($data, 'value') === '' && $slide->hasComments()) { + // Comment only: no rating, but a comment is required (this is not a way to skip). + $comment = self::comment($data); + if ($comment === null) { + throw new VoteException($slide->isStarRating() + ? __('Bitte vergib Sterne oder schreibe einen Kommentar.') + : __('Bitte wähle einen Wert oder schreibe einen Kommentar.')); } - // Counts as taking part, but has no rating and no comment. - return [['numeric_value' => null, 'text_value' => null]]; + return [['numeric_value' => null, 'text_value' => $comment]]; } $value = filter_var($data['value'] ?? null, FILTER_VALIDATE_INT); $min = (int)$slide->setting('scale_min'); diff --git a/templates/Admin/export.php b/templates/Admin/export.php index 591e93b..e2404dd 100644 --- a/templates/Admin/export.php +++ b/templates/Admin/export.php @@ -205,8 +205,8 @@ $bar = function (float $percent, bool $ok = false): string { - - · + + ·

diff --git a/templates/Participate/view.php b/templates/Participate/view.php index 60ccca7..c0836ec 100644 --- a/templates/Participate/view.php +++ b/templates/Participate/view.php @@ -9,7 +9,6 @@ * @var array $state * @var string $participantHash Seed for the shuffled items of ordering slides * @var string|null $ownText Own open answer or scale comment (editable while voting is open) - * @var bool $skipped Whether the participant answered the scale with "Keine Angabe" * @var int $pollIntervalMs */ use App\Service\VoteService; @@ -242,7 +241,7 @@ $countdown = function (?int $remaining): string {

✓

- isVotingOpen() && !$skipped) : + isVotingOpen()) : $isOpen = $slide->type === 'open'; ?>

@@ -310,7 +309,7 @@ $countdown = function (?int $remaining): string {
isPrivate() ? ' aria-describedby="private-hint"' : '' ?>> @@ -320,7 +319,7 @@ $countdown = function (?int $remaining): string {
isPrivate() ? ' aria-describedby="private-hint"' : '' ?>> setting('scale_min'); $v <= $maxValue; $v++) : ?> @@ -332,6 +331,7 @@ $countdown = function (?int $remaining): string {
hasComments()) : ?> +

@@ -343,12 +343,6 @@ $countdown = function (?int $remaining): string { Form->button(__('Absenden'), ['class' => 'button button--primary button--block']) ?> - type === 'scale' && $slide->setting('allow_skip')) : ?> - Form->button(__('Keine Angabe'), [ - 'name' => 'skip', 'value' => '1', 'formnovalidate' => true, - 'class' => 'button button--block button--skip', - ]) ?> - Form->end() ?> diff --git a/templates/Slides/answers.php b/templates/Slides/answers.php index e71510e..b0c3dab 100644 --- a/templates/Slides/answers.php +++ b/templates/Slides/answers.php @@ -31,7 +31,7 @@ $count = match (true) {

question) ?>

-

·

+

·

@@ -86,7 +86,7 @@ $count = match (true) { $created = new DateTime($comment['created']); ?>
  • - +
  • diff --git a/templates/Slides/form.php b/templates/Slides/form.php index 5023a0c..cc092ff 100644 --- a/templates/Slides/form.php +++ b/templates/Slides/form.php @@ -195,12 +195,6 @@ $optionsError = $slide->getError('options_text'); 'placeholder' => __('z. B. sehr'), 'value' => $settings['max_label'], ]) ?>
    - Form->control('settings.allow_skip', [ - 'type' => 'checkbox', - 'label' => __('„Keine Angabe“ erlauben (Teilnehmende können die Frage überspringen)'), - 'checked' => (bool)$settings['allow_skip'], - ]) ?> -

    Form->control('settings.scale_view', [ 'type' => 'select', 'label' => __('In der Präsentation zeigen'), @@ -214,7 +208,7 @@ $optionsError = $slide->getError('options_text');

    Form->control('settings.comments', [ 'type' => 'checkbox', - 'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen)'), + 'label' => __('Kommentarfeld anzeigen (Teilnehmende können ihre Bewertung optional begründen oder auch nur einen Kommentar ohne Bewertung abgeben)'), 'checked' => (bool)$settings['comments'], ]) ?>

    diff --git a/tests/TestCase/Controller/ParticipateControllerTest.php b/tests/TestCase/Controller/ParticipateControllerTest.php index c5efd8f..fef21cb 100644 --- a/tests/TestCase/Controller/ParticipateControllerTest.php +++ b/tests/TestCase/Controller/ParticipateControllerTest.php @@ -239,29 +239,22 @@ class ParticipateControllerTest extends TestCase $this->assertFalse(TableRegistry::getTableLocator()->get('Responses')->exists(['text_value' => 'Hack'])); } - public function testScaleSkipButtonOnlyWithSetting(): void + public function testScaleCommentOnlyWithoutRating(): void { [$poll] = $this->createPoll(); - $slide = $this->createSlide($poll, Slide::TYPE_SCALE); + $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true]]); $this->goLive($poll, $slide); $this->cookie('plenario_pid', self::PID); $this->get('/p/' . $poll->join_code); - $this->assertResponseNotContains('Keine Angabe'); - - $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['allow_skip' => true, 'comments' => true]]); - $this->goLive($poll, $slide); - $this->cookie('plenario_pid', self::PID); - $this->get('/p/' . $poll->join_code); - $this->assertResponseContains('name="skip"'); + $this->assertResponseContains('auch nur einen Kommentar'); + $this->assertResponseNotContains('required>'); $this->cookie('plenario_pid', self::PID); - $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'skip' => '1']); + $this->post("/p/{$poll->join_code}/vote", ['slide_id' => $slide->id, 'comment' => 'Keine Meinung dazu']); $this->assertFlashMessage('Danke für deine Antwort!'); - // No rating, so no comment to add afterwards. $this->cookie('plenario_pid', self::PID); $this->get('/p/' . $poll->join_code); - $this->assertResponseContains('Deine Antwort ist angekommen.'); - $this->assertResponseNotContains('Kommentar hinzufügen'); + $this->assertResponseContains('Keine Meinung dazu'); } } diff --git a/tests/TestCase/Service/VoteServiceTest.php b/tests/TestCase/Service/VoteServiceTest.php index 29aac28..aa8e270 100644 --- a/tests/TestCase/Service/VoteServiceTest.php +++ b/tests/TestCase/Service/VoteServiceTest.php @@ -71,49 +71,60 @@ class VoteServiceTest extends TestCase (new VoteService())->submit($poll, $slide, 'p1', ['value' => '4']); } - public function testScaleSkipCountsAsParticipantButNotInAverage(): void + public function testScaleCommentOnlyCountsAsParticipantButNotInAverage(): void { [$poll] = $this->createPoll(); - $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['scale_min' => 1, 'scale_max' => 5, 'allow_skip' => true]]); + $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['scale_min' => 1, 'scale_max' => 5, 'comments' => true]]); $poll = $this->goLive($poll, $slide); $service = new VoteService(); $service->submit($poll, $slide, 'p1', ['value' => '4']); - $service->submit($poll, $slide, 'p2', ['skip' => '1']); + $service->submit($poll, $slide, 'p2', ['comment' => 'Kann ich nicht beurteilen']); $results = (new ResultsService())->forSlide($slide); $this->assertSame(2, $results['participants']); - $this->assertSame(1, $results['skipped']); + $this->assertSame(1, $results['commentOnly']); $this->assertSame(4.0, (float)$results['average']); $this->assertSame(1, array_sum(array_column($results['buckets'], 'count'))); - $this->assertTrue($service->hasSkipped($slide, 'p2')); - $this->assertFalse($service->hasSkipped($slide, 'p1')); + $this->assertSame(['Kann ich nicht beurteilen'], array_column($results['comments'], 'text')); + $this->assertSame([null], array_column((new ResultsService())->comments($slide), 'value')); // Only once per person, like any answer. $this->expectExceptionMessage('bereits abgestimmt'); $service->submit($poll, $slide, 'p2', ['value' => '2']); } - public function testScaleSkipNeedsTheSetting(): void + public function testScaleWithoutRatingNeedsCommentField(): void { [$poll] = $this->createPoll(); $slide = $this->createSlide($poll, Slide::TYPE_SCALE); $poll = $this->goLive($poll, $slide); - $this->expectExceptionMessage('nicht möglich'); - (new VoteService())->submit($poll, $slide, 'p1', ['skip' => '1']); + $this->expectExceptionMessage('zwischen 1 und 5'); + (new VoteService())->submit($poll, $slide, 'p1', ['comment' => 'Nur Kommentar']); } - public function testScaleSkipHasNoComment(): void + public function testScaleNeedsRatingOrComment(): void { [$poll] = $this->createPoll(); - $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['allow_skip' => true, 'comments' => true]]); + $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true]]); + $poll = $this->goLive($poll, $slide); + + $this->expectExceptionMessage('oder schreibe einen Kommentar'); + (new VoteService())->submit($poll, $slide, 'p1', ['comment' => ' ']); + } + + public function testCommentOnlyAnswerCanBeEditedButNotEmptied(): void + { + [$poll] = $this->createPoll(); + $slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['comments' => true]]); $poll = $this->goLive($poll, $slide); $service = new VoteService(); - $service->submit($poll, $slide, 'p1', ['skip' => '1', 'comment' => 'Ignoriert']); + $service->submit($poll, $slide, 'p1', ['comment' => 'Erst']); + $service->editText($poll, $slide, 'p1', ['comment' => 'Dann']); + $this->assertSame('Dann', $service->ownText($slide, 'p1')); - $this->assertNull($service->ownText($slide, 'p1')); - $this->expectExceptionMessage('keinen Kommentar'); - $service->editText($poll, $slide, 'p1', ['comment' => 'Nachtrag']); + $this->expectExceptionMessage('nicht leer sein'); + $service->editText($poll, $slide, 'p1', ['comment' => '']); } public function testMultipleChoiceResults(): void diff --git a/webroot/css/plenario.css b/webroot/css/plenario.css index 35d1d78..b509921 100644 --- a/webroot/css/plenario.css +++ b/webroot/css/plenario.css @@ -225,7 +225,6 @@ h3 { font-size: 1.05rem; margin-top: 1.6em; } .button--danger { color: var(--danger); } .button--danger:hover { border-color: var(--danger); } .button--ghost { border-color: transparent; background: transparent; } -.button--skip { margin-top: 8px; } .button--small { padding: 6px 10px; font-size: .85rem; } .header-tools { display: flex; align-items: center; gap: 8px; } .button--block { width: 100%; padding: 14px; font-size: 1.05rem; } diff --git a/webroot/js/plenario.js b/webroot/js/plenario.js index 1e53e2d..5a8b646 100644 --- a/webroot/js/plenario.js +++ b/webroot/js/plenario.js @@ -616,7 +616,11 @@ 'Kommentar ' + (Comments.index + 1) + ' von ' + Comments.items.length; text.textContent = item.text; var value = node.querySelector('[data-comment-value]'); - value.textContent = item.value === null || item.value === undefined ? '' : 'Bewertung: ' + Comments.format(item.value); + // With ratings shown, comments sent without one say so (keeps the box at the same height). + var rated = Comments.items.some(function (other) { return other.value !== null && other.value !== undefined; }); + value.textContent = item.value === null || item.value === undefined + ? (rated ? 'Ohne Bewertung' : '') + : 'Bewertung: ' + Comments.format(item.value); value.hidden = value.textContent === ''; // Only announce changes the viewer triggered, not every automatic rotation. node.setAttribute('aria-live', Comments.paused ? 'polite' : 'off'); @@ -797,7 +801,7 @@ el('span', { class: 'average__count', text: total + (total === 1 ? ' Bewertung' : ' Bewertungen') - + (results.skipped ? ' · ' + results.skipped + '× keine Angabe' : '') + + (results.commentOnly ? ' · ' + results.commentOnly + '× nur Kommentar' : '') }) ]); }, @@ -3334,11 +3338,10 @@ if (event.defaultPrevented) { return; // handled via fetch (word cloud) } - // All buttons (e.g. "Absenden" and "Keine Angabe"); the pressed one is already part of the request. - var buttons = form.querySelectorAll('button[type=submit], button:not([type])'); - setTimeout(function () { - buttons.forEach(function (button) { button.disabled = true; }); - }, 0); + var button = form.querySelector('button[type=submit], button:not([type])'); + if (button) { + setTimeout(function () { button.disabled = true; }, 0); + } }); }); });