feat: generate draft assignments from a staffing matrix

This commit is contained in:
fromme committed 2026-10-15 18:11:51 +02:00
1 parent 3116d23199
commit 2fc9806c69
41 files changed
+2618

No files matched your search

+19
View File
@@ -155,6 +155,8 @@ class DestinationRowTest extends TestCase
'pickups' => '[{"busProId":4,"city":"Karlsruhe","street":"A5 - Autohof Bruchsal","time":"23:59","datetime":"2026-04-04T23:59:00+02:00"}]',
'cost_unit' => '4711',
'country' => 'ch',
'product_code' => 'LPJPGJ',
'imported_at' => '2026-08-13 03:00:00',
'created_at' => '2026-08-13 03:00:00',
], $payload);
}
@@ -169,16 +171,33 @@ class DestinationRowTest extends TestCase
$this->assertEquals('Sportclub Jenatsch', $payload['hotel']);
$this->assertEquals('LPJGR', $payload['hotel_code']);
$this->assertEquals('2026-08-13 03:00:00', $payload['updated_at']);
$this->assertEquals('2026-08-13 03:00:00', $payload['imported_at']);
$this->assertEquals('LPJPGJ', $payload['product_code']);
$this->assertArrayNotHasKey('created_at', $payload);
$this->assertArrayNotHasKey('bus_pro_id', $payload);
$this->assertArrayNotHasKey('hotel_bus_pro_id', $payload);
}
public function testTheProductCodeIsTrimmed(): void
{
// upstream carries "DPWAST " with a trailing blank
$row = DestinationRow::fromArray($this->getRowData(['productCode' => 'DPWAST ']));
$this->assertSame('DPWAST', $row->productCode);
}
public function testAMissingOrEmptyProductCodeIsNull(): void
{
$this->assertNull(DestinationRow::fromArray($this->getRowData(['productCode' => null]))->productCode);
$this->assertNull(DestinationRow::fromArray($this->getRowData(['productCode' => ' ']))->productCode);
}
private function getRowData(array $overrides = []): array
{
return array_merge([
'busProId' => 11886,
'code' => 'LPJPGJ040426',
'productCode' => 'LPJPGJ',
'product' => 'Lenzerheide - Sportclub Jenatsch',
'dateFrom' => '2026-04-04',
'dateTo' => '2026-04-11',