diff --git a/motorradig/views/tour/edit.php b/motorradig/views/tour/edit.php index e022b40..5d82d68 100644 --- a/motorradig/views/tour/edit.php +++ b/motorradig/views/tour/edit.php @@ -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; diff --git a/motorradig/views/tour/show.php b/motorradig/views/tour/show.php index 897acb0..97fb6cc 100644 --- a/motorradig/views/tour/show.php +++ b/motorradig/views/tour/show.php @@ -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;