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
@@ -71,6 +71,51 @@ class VoteServiceTest extends TestCase
|
||||
(new VoteService())->submit($poll, $slide, 'p1', ['value' => '4']);
|
||||
}
|
||||
|
||||
public function testScaleSkipCountsAsParticipantButNotInAverage(): void
|
||||
{
|
||||
[$poll] = $this->createPoll();
|
||||
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['scale_min' => 1, 'scale_max' => 5, 'allow_skip' => true]]);
|
||||
$poll = $this->goLive($poll, $slide);
|
||||
$service = new VoteService();
|
||||
$service->submit($poll, $slide, 'p1', ['value' => '4']);
|
||||
$service->submit($poll, $slide, 'p2', ['skip' => '1']);
|
||||
|
||||
$results = (new ResultsService())->forSlide($slide);
|
||||
$this->assertSame(2, $results['participants']);
|
||||
$this->assertSame(1, $results['skipped']);
|
||||
$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'));
|
||||
|
||||
// Only once per person, like any answer.
|
||||
$this->expectExceptionMessage('bereits abgestimmt');
|
||||
$service->submit($poll, $slide, 'p2', ['value' => '2']);
|
||||
}
|
||||
|
||||
public function testScaleSkipNeedsTheSetting(): 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']);
|
||||
}
|
||||
|
||||
public function testScaleSkipHasNoComment(): void
|
||||
{
|
||||
[$poll] = $this->createPoll();
|
||||
$slide = $this->createSlide($poll, Slide::TYPE_SCALE, ['settings' => ['allow_skip' => true, 'comments' => true]]);
|
||||
$poll = $this->goLive($poll, $slide);
|
||||
$service = new VoteService();
|
||||
$service->submit($poll, $slide, 'p1', ['skip' => '1', 'comment' => 'Ignoriert']);
|
||||
|
||||
$this->assertNull($service->ownText($slide, 'p1'));
|
||||
$this->expectExceptionMessage('keinen Kommentar');
|
||||
$service->editText($poll, $slide, 'p1', ['comment' => 'Nachtrag']);
|
||||
}
|
||||
|
||||
public function testMultipleChoiceResults(): void
|
||||
{
|
||||
[$poll] = $this->createPoll();
|
||||
|
||||
Reference in new issue
Block a user