|
|
@ -1,5 +1,6 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Engelsystem\Database\DB;
|
|
|
|
use Engelsystem\Database\DB;
|
|
|
|
use Engelsystem\Models\User\User;
|
|
|
|
use Engelsystem\Models\User\User;
|
|
|
|
|
|
|
|
|
|
|
@ -202,9 +203,10 @@ function ShiftEntries_upcoming_for_user($userId)
|
|
|
|
* Returns shifts completed by the given user.
|
|
|
|
* Returns shifts completed by the given user.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param int $userId
|
|
|
|
* @param int $userId
|
|
|
|
|
|
|
|
* @param Carbon|null $sinceTime
|
|
|
|
* @return array
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function ShiftEntries_finished_by_user($userId)
|
|
|
|
function ShiftEntries_finished_by_user($userId, Carbon $sinceTime = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return DB::select('
|
|
|
|
return DB::select('
|
|
|
|
SELECT *
|
|
|
|
SELECT *
|
|
|
@ -214,6 +216,7 @@ function ShiftEntries_finished_by_user($userId)
|
|
|
|
WHERE `ShiftEntry`.`UID` = ?
|
|
|
|
WHERE `ShiftEntry`.`UID` = ?
|
|
|
|
AND `Shifts`.`end` < ?
|
|
|
|
AND `Shifts`.`end` < ?
|
|
|
|
AND `ShiftEntry`.`freeloaded` = 0
|
|
|
|
AND `ShiftEntry`.`freeloaded` = 0
|
|
|
|
|
|
|
|
' . ($sinceTime ? 'AND Shifts.start >= ' . $sinceTime->getTimestamp() : '') . '
|
|
|
|
ORDER BY `Shifts`.`end` desc
|
|
|
|
ORDER BY `Shifts`.`end` desc
|
|
|
|
',
|
|
|
|
',
|
|
|
|
[
|
|
|
|
[
|
|
|
|