summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcbluoss <deinkoks@gmail.com>2019-12-07 20:38:56 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2019-12-12 18:48:22 +0100
commit74b464aab5845d1d46378397e9c75fa5eac5de8e (patch)
tree8068a85cdb82959e8136724f44125e0cdec28e5a
parentd70d7c6436c9b5e0fe9deeb9f35fe8b3f09f3f53 (diff)
ShiftEntry query now returns the related user.name as well.
This was done for API requests to save additional queries, but should allow us to remove some queries pretty much everywhere shifts get listed (will be done in a new PR eventually)
-rw-r--r--includes/model/Shifts_model.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 756d9284..feecdf60 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -636,8 +636,9 @@ function Shift($shift_id)
}
$shiftsEntry_source = DB::select('
- SELECT `id`, `TID` , `UID` , `freeloaded`
+ SELECT `ShiftEntry`.`id`, `ShiftEntry`.`TID` , `ShiftEntry`.`UID` , `ShiftEntry`.`freeloaded`, `users`.`name` AS `username`
FROM `ShiftEntry`
+ LEFT JOIN `users` ON (`users`.`id` = `ShiftEntry`.`UID`)
WHERE `SID`=?', [$shift_id]);
$result['ShiftEntry'] = $shiftsEntry_source;