Task: Refactor contingent calculation logic

This commit is contained in:
Björn Fromme
2023-08-25 10:32:46 +02:00
parent c03ef48b7a
commit cf367e9e1c
@@ -84,17 +84,15 @@ class ContingentRepository extends AbstractRepository implements ProviderInterfa
$dates[$row['date']] = [
'status' => Contingent::STATUS_OK,
'date' => $row['date'],
'minPrice' => $row['minPrice'],
'pax' => $row['pax'],
'available' => $row['available'],
'pax' => 0,
'available' => 0,
];
} else {
if ($row['status'] !== Contingent::STATUS_OK) {
$dates[$row['date']]['status'] = $row['status'];
}
$dates[$row['date']]['pax'] += $row['pax'];
$dates[$row['date']]['available'] += $row['available'];
}
if ($row['status'] !== Contingent::STATUS_OK) {
$dates[$row['date']]['status'] = $row['status'];
}
$dates[$row['date']]['pax'] += $row['pax'];
$dates[$row['date']]['available'] += $row['available'];
}
$events = [];