chore: code cleanup

This commit is contained in:
Björn Fromme
2025-08-21 14:20:43 +02:00
parent c4e28818e0
commit e36009008c
273 changed files with 547 additions and 531 deletions
+4 -4
View File
@@ -5,7 +5,6 @@ namespace App\Service\Assignment;
use App\Entity\Assignment;
use App\Model\TimelineItem;
use Carbon\CarbonPeriod;
use function Symfony\Component\String\b;
/**
* Service for processing assignments into timeline visualization data.
@@ -20,6 +19,7 @@ class TimelineService
* distributing them across multiple rows to avoid date overlaps.
*
* @param Assignment[] $assignments Array of assignments to process
*
* @return array Multi-dimensional array: [hotelCode][rowIndex][itemKey] => TimelineItem
*/
public function preprocess(array $assignments): array
@@ -46,14 +46,14 @@ class TimelineService
// Handle assignments with no dispositions - create items for all available slots
if (0 === $dispositionsCount) {
$item = TimelineItem::fromAssignment($assignment);
for ($i = 1; $i <= $assignment->getAvailableDispositions(); $i++) {
for ($i = 1; $i <= $assignment->getAvailableDispositions(); ++$i) {
$this->addItem($rows[$hotelCode], $item);
}
} else {
// Create items for remaining vacant slots if any
if ($dispositionsCount < $dispositionsAvailable) {
$item = TimelineItem::fromAssignment($assignment);
for ($i = 1; $i <= $dispositionsAvailable - $dispositionsCount; $i++) {
for ($i = 1; $i <= $dispositionsAvailable - $dispositionsCount; ++$i) {
$this->addItem($rows[$hotelCode], $item);
}
}
@@ -73,7 +73,7 @@ class TimelineService
* Finds the first available row where the item doesn't overlap with existing items,
* or creates a new row if necessary.
*
* @param array $rows Reference to the rows array for a specific hotel
* @param array $rows Reference to the rows array for a specific hotel
* @param TimelineItem $item The timeline item to add
*/
private function addItem(array &$rows, TimelineItem $item): void