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)
This commit is contained in:
cbluoss 2019-12-07 20:38:56 +01:00 committed by Igor Scheller
parent d70d7c6436
commit 74b464aab5
1 changed files with 2 additions and 1 deletions

View File

@ -636,8 +636,9 @@ function Shift($shift_id)
} }
$shiftsEntry_source = DB::select(' $shiftsEntry_source = DB::select('
SELECT `id`, `TID` , `UID` , `freeloaded` SELECT `ShiftEntry`.`id`, `ShiftEntry`.`TID` , `ShiftEntry`.`UID` , `ShiftEntry`.`freeloaded`, `users`.`name` AS `username`
FROM `ShiftEntry` FROM `ShiftEntry`
LEFT JOIN `users` ON (`users`.`id` = `ShiftEntry`.`UID`)
WHERE `SID`=?', [$shift_id]); WHERE `SID`=?', [$shift_id]);
$result['ShiftEntry'] = $shiftsEntry_source; $result['ShiftEntry'] = $shiftsEntry_source;