Commit e05feb74 authored by Michael Koch's avatar Michael Koch
Browse files

Add array_unique to array_merge calls, so checking for more than 11...

Add array_unique to array_merge calls, so checking for more than 11 reservations should work properly (should fix #11)
parent 968c9082
......@@ -446,7 +446,7 @@ function addReservation($q) {
"to_event_before" => $q->to_event,
"rooms" => array($q->room_id)
);
$existing_reservations = array_merge($existing_reservations, getReservationsFiltered(json_decode(json_encode($resv_options), false), true));
$existing_reservations = array_unique(array_merge($existing_reservations, getReservationsFiltered(json_decode(json_encode($resv_options), false), true)));
if (sizeof($existing_reservations) > 0) {
fail("Timeslot already booked");
......@@ -479,7 +479,7 @@ function addReservation($q) {
"rooms" => array($q->room_id),
"confirmed" => 1
);
$existing_reservations = array_merge($existing_reservations, getReservationsFiltered(json_decode(json_encode($resv_options), false), true));
$existing_reservations = array_unique(array_merge($existing_reservations, getReservationsFiltered(json_decode(json_encode($resv_options), false), true)));
if (sizeof($existing_reservations) > 11) {
fail("Studyspace overbooked");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment