feat: keep questionnaires until submitted, remind teamers daily and take bus feedback per leg

This commit is contained in:
fromme committed 2026-11-10 16:38:51 +01:00
1 parent abf9c1be0b
commit e72616fdbf
37 files changed
+1119 -238

No files matched your search

+21 -4
View File
@@ -46,6 +46,19 @@ class QuestionnaireCatalogTest extends TestCase
}
}
/**
* An escort may ride the outbound bus, the return bus or both, so the bus feedback is answered
* per leg and no longer asks for the direction.
*/
public function testOnlyTheBusFeedbackIsAnsweredPerLeg(): void
{
$catalog = new QuestionnaireCatalog(self::SHIPPED_DIR);
$this->assertTrue($catalog->get(QuestionnaireCatalog::BUS_FEEDBACK)->perBusLeg);
$this->assertNull($catalog->get(QuestionnaireCatalog::BUS_FEEDBACK)->getQuestion('direction'));
$this->assertFalse($catalog->get(QuestionnaireCatalog::TEAMER_FEEDBACK)->perBusLeg);
}
public function testTheTwoQuestionnairesAreTheCurrentKeys(): void
{
$this->assertSame(
@@ -112,16 +125,16 @@ class QuestionnaireCatalogTest extends TestCase
$this->assertSame('Alte Frage', $catalog->get('sample', 1)->getQuestion('answer')->label);
}
public function testTheWindowStartsTheGivenDaysBeforeToday(): void
public function testTheGoLiveDateIsADay(): void
{
$this->assertEquals(new \DateTimeImmutable('today -2 days'), QuestionnaireCatalog::windowStart(2));
$this->assertEquals(new \DateTimeImmutable('2026-11-10 00:00'), QuestionnaireCatalog::parseGoLive('2026-11-10'));
}
public function testANegativeWindowFailsLoudly(): void
public function testAMalformedGoLiveDateFailsLoudly(): void
{
$this->expectException(\InvalidArgumentException::class);
QuestionnaireCatalog::windowStart(-1);
QuestionnaireCatalog::parseGoLive('10.11.2026');
}
public function testUnknownQuestionnaireIsRejected(): void
@@ -151,6 +164,10 @@ class QuestionnaireCatalogTest extends TestCase
static fn (array $d): array => self::withQuestion($d, 1, ['requried' => true]),
'unknown field(s) requried',
];
yield 'per_bus_leg not a boolean' => [
static fn (array $d): array => ['per_bus_leg' => 'yes'] + $d,
'per_bus_leg must be true or false',
];
yield 'unknown type' => [
static fn (array $d): array => self::withQuestion($d, 1, ['type' => 'slider']),
'unknown type "slider"',