metrics: Fix users stats

This commit is contained in:
Igor Scheller 2018-12-25 20:56:46 +01:00
parent 31d9efb2b8
commit 26f58b8156
1 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class Stats
$query $query
->leftJoin('UserWorkLog', 'UserWorkLog.user_id', '=', 'users.id') ->leftJoin('UserWorkLog', 'UserWorkLog.user_id', '=', 'users.id')
->leftJoin('ShiftEntry', 'ShiftEntry.UID', '=', 'users.id') ->leftJoin('ShiftEntry', 'ShiftEntry.UID', '=', 'users.id')
->groupBy('users.id'); ->distinct();
$query->where(function ($query) use ($working) { $query->where(function ($query) use ($working) {
/** @var QueryBuilder $query */ /** @var QueryBuilder $query */
@ -48,6 +48,7 @@ class Stats
return; return;
} }
$query $query
->whereNull('ShiftEntry.SID') ->whereNull('ShiftEntry.SID')
->whereNull('UserWorkLog.work_hours'); ->whereNull('UserWorkLog.work_hours');
@ -56,7 +57,7 @@ class Stats
} }
return $query return $query
->count(); ->count('users.id');
} }
/** /**