fixes #548: users with only worklog and no shifts had 0 minutes on admin-active. query fixed

This commit is contained in:
msquare 2018-12-27 19:53:48 +01:00
parent db26412e6c
commit 794df6f99e
1 changed files with 3 additions and 3 deletions

View File

@ -262,11 +262,11 @@ function User_get_shifts_sum_query()
{ {
$nightShifts = config('night_shifts'); $nightShifts = config('night_shifts');
if (!$nightShifts['enabled']) { if (!$nightShifts['enabled']) {
return 'SUM(`end` - `start`)'; return 'COALESCE(SUM(`end` - `start`), 0)';
} }
return sprintf(' return sprintf('
SUM( COALESCE(SUM(
(1 + (1 +
( (
(HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < %2$d) (HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < %2$d)
@ -276,7 +276,7 @@ function User_get_shifts_sum_query()
) )
* (`Shifts`.`end` - `Shifts`.`start`) * (`Shifts`.`end` - `Shifts`.`start`)
* (1 - (%3$d + 1) * `ShiftEntry`.`freeloaded`) * (1 - (%3$d + 1) * `ShiftEntry`.`freeloaded`)
) ), 0)
', ',
$nightShifts['start'], $nightShifts['start'],
$nightShifts['end'], $nightShifts['end'],