diff options
author | msquare <msquare@notrademark.de> | 2016-11-12 20:15:25 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-11-12 20:15:25 +0100 |
commit | 106a6788086f9be3ef6d30d1844f512fcbf22e23 (patch) | |
tree | 14f3d69c84b72f8a5f4ce4a653e9edddfb47766c /includes | |
parent | 7bafe3f24c9c2b856242cad5e4530f63b3792b7b (diff) |
fix wrong variable
Diffstat (limited to 'includes')
-rw-r--r-- | includes/model/NeededAngelTypes_model.php | 1 | ||||
-rw-r--r-- | includes/model/Shifts_model.php | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/includes/model/NeededAngelTypes_model.php b/includes/model/NeededAngelTypes_model.php index 48f8ed20..7309f7cd 100644 --- a/includes/model/NeededAngelTypes_model.php +++ b/includes/model/NeededAngelTypes_model.php @@ -88,6 +88,7 @@ function NeededAngelTypes_by_shift($shiftId) { foreach ($needed_angeltypes_source as $angeltype) { $shift_entries = ShiftEntries_by_shift_and_angeltype($shiftId, $angeltype['angel_type_id']); + // TODO: Substract shift entries which are freeloader $angeltype['taken'] = count($shift_entries); $angeltype['shift_entries'] = $shift_entries; $needed_angeltypes[] = $angeltype; diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 1eba5ba1..392adfaa 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -101,7 +101,7 @@ 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['angel_type_id'] == $angeltype_id) { return $needed_angeltype['taken'] < $needed_angeltype['count']; } } @@ -112,9 +112,12 @@ function Shift_occupied($shift_id, $angeltype_id) { /** * Check if an angel can sign up for given shift. * - * @param Shift $shift - * @param AngelType $angeltype - * @param array<Shift> $user_shifts + * @param Shift $shift + * The shift + * @param AngelType $angeltype + * The angeltype to which the user wants to sign up + * @param array<Shift> $user_shifts + * List of the users shifts */ function Shift_signup_allowed($shift, $angeltype, $user_angeltype = null, $user_shifts = null) { global $user, $privileges; |