From 5456fea5031000a6325cdcae5f1e9d4c16b6ed50 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 29 Aug 2018 23:10:05 +0200 Subject: $bugfixes --- includes/model/Shifts_model.php | 4 +++- includes/model/User_model.php | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'includes/model') diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 94513ff3..cf6f5609 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -293,7 +293,9 @@ function Shift_free_entries($needed_angeltype, $shift_entries) $taken++; } } - return max(0, $needed_angeltype['count'] - $taken); + + $neededAngels = !empty($needed_angeltype) ? $needed_angeltype['count'] : 0; + return max(0, $neededAngels - $taken); } /** diff --git a/includes/model/User_model.php b/includes/model/User_model.php index d2498462..cbdb5efe 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -39,6 +39,10 @@ function User_tshirt_score($user) $user['UID'], time() ]); + if (!isset($result_shifts['tshirt_score'])) { + $result_shifts = ['tshirt_score' => 0]; + } + $result_worklog = DB::selectOne(' SELECT SUM(`work_hours`) AS `tshirt_score` FROM `User` @@ -49,6 +53,9 @@ function User_tshirt_score($user) $user['UID'], time() ]); + if (!isset($result_worklog['tshirt_score'])) { + $result_worklog = ['tshirt_score' => 0]; + } return $result_shifts['tshirt_score'] + $result_worklog['tshirt_score']; } -- cgit v1.2.3-54-g00ecf