From 100d62134fc751d1a1cfbe975f0d48a6416b2c79 Mon Sep 17 00:00:00 2001 From: Xu Date: Sat, 2 Mar 2024 22:10:20 +0100 Subject: [PATCH] fix table on admin_active length and score --- includes/pages/admin_active.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index c16d29ee..06a35640 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -1,6 +1,7 @@ shiftEntries() + ->with('shift') + ->get(); + foreach ($shiftEntries as $entry) { + if ($entry->freeloaded || $entry->shift->start > Carbon::now()) { + continue; + } + $timeSum += ($entry->shift->end->timestamp - $entry->shift->start->timestamp); + } + foreach ($usr->worklogs as $worklog) { + $timeSum += $worklog->hours * 3600; + } + $shirtSize = $usr->personalData->shirt_size; $userData = []; $userData['no'] = count($matched_users) + 1; @@ -236,7 +252,8 @@ function admin_active() if ($goodie_tshirt) { $userData['shirt_size'] = (isset($tshirt_sizes[$shirtSize]) ? $tshirt_sizes[$shirtSize] : ''); } - $userData['work_time'] = round($usr['shift_length'] / 60) + $userData['work_time'] = sprintf('%.2f', round($timeSum / 3600, 2)) . ' h'; + $userData['score'] = round($usr['shift_length'] / 60) . ' min (' . sprintf('%.2f', $usr['shift_length'] / 3600) . ' h)'; $userData['active'] = icon_bool($usr->state->active == 1); $userData['force_active'] = icon_bool($usr->state->force_active == 1); @@ -362,6 +379,12 @@ function admin_active() [ 'shift_count' => __('Shifts'), 'work_time' => __('Length'), + ], + ($goodie_enabled ? ['score' => ($goodie_tshirt + ? __('T-shirt score') + : __('Goodie score') + )] : []), + [ 'active' => __('Active?'), ], (config('enable_force_active') ? ['force_active' => __('Forced'),] : []),