summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-12 19:05:36 +0100
committermsquare <msquare@notrademark.de>2016-11-12 19:05:36 +0100
commit7bafe3f24c9c2b856242cad5e4530f63b3792b7b (patch)
tree09fccde9ce97731c46b1fbbcde97286b74a2436c /includes/model/Shifts_model.php
parentc61e888de484c4571113cb46b4e131ddd9975f2f (diff)
fix shift occupied method
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r--includes/model/Shifts_model.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index aab822b7..1eba5ba1 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -94,15 +94,15 @@ function Shift_collides($shift, $shifts) {
*
* @param int $shift_id
* ID of the shift to check
+ * @param int $angeltype_id
+ * ID of the angeltype that should be checked
*/
-function Shift_occupied($shift_id) {
- $needed_angeltypes = NeededAngelTypes_by_shift($shift['SID']);
+function Shift_occupied($shift_id, $angeltype_id) {
+ $needed_angeltypes = NeededAngelTypes_by_shift($shift_id);
foreach ($needed_angeltypes as $needed_angeltype) {
if ($needed_angeltype['angel_type_id'] == $angeltype['id']) {
- if ($needed_angeltype['taken'] < $needed_angeltype['count']) {
- return false;
- }
+ return $needed_angeltype['taken'] < $needed_angeltype['count'];
}
}
@@ -136,7 +136,7 @@ function Shift_signup_allowed($shift, $angeltype, $user_angeltype = null, $user_
}
// you canot join if shift is full
- $user_may_join_shift = ! Shift_occupied($shift['SID']);
+ $user_may_join_shift = ! Shift_occupied($shift['SID'], $angeltype['id']);
// you cannot join if user alread joined a parallel or this shift
$user_may_join_shift &= ! Shift_collides($shift, $user_shifts);