From 74b464aab5845d1d46378397e9c75fa5eac5de8e Mon Sep 17 00:00:00 2001 From: cbluoss Date: Sat, 7 Dec 2019 20:38:56 +0100 Subject: [PATCH] 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) --- includes/model/Shifts_model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;