summaryrefslogtreecommitdiff
path: root/includes/model/User_model.php
diff options
context:
space:
mode:
authorBot <bot@myigel.name>2018-01-14 18:09:34 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2018-01-14 18:09:34 +0100
commit5227fe6a94bd8b510aa49b40bfb36fad73ae4afb (patch)
treeec360624a3b2177d0c9d9b7998f9c6d74bfe7b3d /includes/model/User_model.php
parentfe58e4f4220d6685b91bf516374e33936e1075e3 (diff)
Formatting
Diffstat (limited to 'includes/model/User_model.php')
-rw-r--r--includes/model/User_model.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index a439b199..70a03736 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -20,12 +20,14 @@ function User_delete($user_id)
/**
* Returns the tshirt score (number of hours counted for tshirt).
* Accounts only ended shifts.
- *
+ *
* @param array[] $user
+ * @return int
*/
-function User_tshirt_score($user) {
+function User_tshirt_score($user)
+{
$shift_sum_formula = config('shift_sum_formula');
-
+
$result_shifts = DB::selectOne('
SELECT ROUND((' . $shift_sum_formula . ') / 3600, 2) AS `tshirt_score`
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
@@ -33,7 +35,7 @@ function User_tshirt_score($user) {
WHERE `User`.`UID` = ?
AND `Shifts`.`end` < ?
GROUP BY `User`.`UID`
- ',[
+ ', [
$user['UID'],
time()
]);
@@ -43,11 +45,11 @@ function User_tshirt_score($user) {
LEFT JOIN `UserWorkLog` ON `User`.`UID` = `UserWorkLog`.`user_id`
WHERE `User`.`UID` = ?
AND `UserWorkLog`.`work_timestamp` < ?
- ',[
+ ', [
$user['UID'],
time()
]);
-
+
return $result_shifts['tshirt_score'] + $result_worklog['tshirt_score'];
}
@@ -385,7 +387,7 @@ function User_validate_planned_departure_date($planned_arrival_date, $planned_de
return new ValidationResult(false, $planned_arrival_date);
}
$event_config = EventConfig();
- if (empty($event_config )) {
+ if (empty($event_config)) {
// Nothing to validate against
return new ValidationResult(true, $planned_departure_date);
}