fix wrong variable

This commit is contained in:
msquare 2016-11-12 20:15:25 +01:00
parent 7bafe3f24c
commit 106a678808
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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'];
}
}
@ -113,8 +113,11 @@ function Shift_occupied($shift_id, $angeltype_id) {
* Check if an angel can sign up for given shift.
*
* @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;