Zimmerliste: komplett freie Zimmer ans Ende der jeweiligen Sektion
This commit is contained in:
parent
2c72a2807d
commit
74925aa513
2 changed files with 10 additions and 8 deletions
|
|
@ -40,11 +40,12 @@ uasort($roomMap, static function (array $a, array $b): int {
|
|||
return $a['capacity'] <=> $b['capacity'];
|
||||
}
|
||||
|
||||
$aFree = $a['booked'] >= $a['capacity'];
|
||||
$bFree = $b['booked'] >= $b['capacity'];
|
||||
// Komplett freie Zimmer gehören ans Ende der Sektion.
|
||||
$aEmpty = $a['booked'] === 0;
|
||||
$bEmpty = $b['booked'] === 0;
|
||||
|
||||
if ($aFree !== $bFree) {
|
||||
return $aFree <=> $bFree;
|
||||
if ($aEmpty !== $bEmpty) {
|
||||
return $aEmpty <=> $bEmpty;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -67,11 +67,12 @@ $isPast = false;
|
|||
return $a['capacity'] <=> $b['capacity'];
|
||||
}
|
||||
|
||||
$aFree = count($a['people']) >= $a['capacity'];
|
||||
$bFree = count($b['people']) >= $b['capacity'];
|
||||
// Komplett freie Zimmer gehören ans Ende der Sektion.
|
||||
$aEmpty = count($a['people']) === 0;
|
||||
$bEmpty = count($b['people']) === 0;
|
||||
|
||||
if ($aFree !== $bFree) {
|
||||
return $aFree <=> $bFree;
|
||||
if ($aEmpty !== $bEmpty) {
|
||||
return $aEmpty <=> $bEmpty;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue