summaryrefslogtreecommitdiff
path: root/includes/pages/admin_active.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-29 19:06:23 +0100
committerGitHub <noreply@github.com>2017-12-29 19:06:23 +0100
commit372f474dbcf7524cc10aff0be0bb39c1a90df1f4 (patch)
tree3870eaeaa468caeee9c24f63f0f942a7548aba3b /includes/pages/admin_active.php
parent14584b96114d2fcb0dabe49a9c857ff241421cc8 (diff)
parent4579509b0e21d33ae27ecb5910fdc1d31b1e027a (diff)
Merge pull request #407 from engelsystem/feature-work-log
Feature work log
Diffstat (limited to 'includes/pages/admin_active.php')
-rw-r--r--includes/pages/admin_active.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index 576cdc49..f3a28061 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -58,7 +58,10 @@ function admin_active()
SELECT
`User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
- %s AS `shift_length`
+ (%s + (
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`User`.`UID`
+ AND `work_timestamp` < %s
+ )) AS `shift_length`
FROM `User`
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
@@ -69,6 +72,7 @@ function admin_active()
%s
',
$shift_sum_formula,
+ time(),
$limit
));
$user_nicks = [];
@@ -140,7 +144,10 @@ function admin_active()
SELECT
`User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
- %s AS `shift_length`
+ (%s + (
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`User`.`UID`
+ AND `work_timestamp` < %s
+ )) AS `shift_length`
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` '
. ($show_all_shifts ? '' : 'AND (`Shifts`.`end` < ' . time() . " OR `Shifts`.`end` IS NULL)") . '
@@ -150,6 +157,7 @@ function admin_active()
%s
',
$shift_sum_formula,
+ time(),
$limit
));
$matched_users = [];