Add "Keine Angabe" to scales and an "Enthaltung" shortcut for choice slides
Scales and star ratings get an optional "Keine Angabe" answer (setting allow_skip). It counts as taking part but stays out of the average and the distribution; the number is shown separately on stage, in the evaluation and in the PDF. The choice form gets a button that appends an "Enthaltung" option. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1b48ce7852
commit
d6432911ed
14 files changed
+195
-11
No files matched your search
@@ -179,6 +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.'));
|
||||
}
|
||||
$row->text_value = $text;
|
||||
$this->Responses->saveOrFail($row);
|
||||
});
|
||||
@@ -203,6 +206,22 @@ 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.
|
||||
*
|
||||
@@ -682,6 +701,14 @@ 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.'));
|
||||
}
|
||||
|
||||
// Counts as taking part, but has no rating and no comment.
|
||||
return [['numeric_value' => null, 'text_value' => null]];
|
||||
}
|
||||
$value = filter_var($data['value'] ?? null, FILTER_VALIDATE_INT);
|
||||
$min = (int)$slide->setting('scale_min');
|
||||
$max = (int)$slide->setting('scale_max');
|
||||
|
||||
Reference in new issue
Block a user