summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorJan-Philipp Litza <janphilipp@litza.de>2012-12-26 17:27:27 +0100
committerJan-Philipp Litza <janphilipp@litza.de>2012-12-26 17:27:27 +0100
commit3cc2896376c4ef5b8d01320259010ba4e4576a3a (patch)
treeb5fd6883bb65cfc2e09e850b843c2a6c56a7848a /includes
parent51c6547610066912c0b0a3e6309cfb6b149aa0c2 (diff)
multiply night shifts by 2 (confable with raw mysql)
Diffstat (limited to 'includes')
-rw-r--r--includes/pages/admin_active.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index 0dabe568..241d0904 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -1,6 +1,6 @@
<?php
function admin_active() {
- global $tshirt_sizes;
+ global $tshirt_sizes, $shift_sum_formula;
$msg = "";
$search = "";
@@ -24,7 +24,7 @@ function admin_active() {
$limit = " LIMIT " . $count;
if (isset ($_REQUEST['ack'])) {
sql_query("UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0");
- $users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, SUM(`end`-`start`) as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
+ $users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
$user_nicks = array();
foreach ($users as $usr) {
sql_query("UPDATE `User` SET `Aktiv` = 1 WHERE `UID`=" . sql_escape($usr['UID']));
@@ -80,7 +80,7 @@ function admin_active() {
else $msg = error("Angel not found.", true);
}
- $users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, SUM(`end`-`start`) as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
+ $users = sql_select("SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, ${shift_sum_formula} as `shift_length` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` WHERE `User`.`Gekommen` = 1 GROUP BY `User`.`UID` ORDER BY `shift_length` DESC" . $limit);
$table = "";
if ($search == "")
@@ -141,4 +141,4 @@ function admin_active() {
'link' => page_link_to('admin_active')
));
}
-?> \ No newline at end of file
+?>