summaryrefslogtreecommitdiff
path: root/includes/pages/guest_stats.php
diff options
context:
space:
mode:
authorBot <bot@myigel.name>2017-01-03 14:12:17 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-01-03 15:32:59 +0100
commit55141154c083acc2d0397f4c62b4e0be1c7a19fa (patch)
tree7e5e54a19f7df976fa68c42f21f1484112a7c257 /includes/pages/guest_stats.php
parent356b2582f3e6a43ecf2607acad4a7fe0b37f659a (diff)
Replaced " with '
Diffstat (limited to 'includes/pages/guest_stats.php')
-rw-r--r--includes/pages/guest_stats.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/includes/pages/guest_stats.php b/includes/pages/guest_stats.php
index 1994f044..c4e1af74 100644
--- a/includes/pages/guest_stats.php
+++ b/includes/pages/guest_stats.php
@@ -8,27 +8,37 @@ function guest_stats()
if ($_REQUEST['api_key'] == $api_key) {
$stats = [];
- list($user_count) = sql_select("SELECT count(*) AS `user_count` FROM `User`");
+ list($user_count) = sql_select('SELECT count(*) AS `user_count` FROM `User`');
$stats['user_count'] = $user_count['user_count'];
- list($arrived_user_count) = sql_select("SELECT count(*) AS `user_count` FROM `User` WHERE `Gekommen`=1");
+ list($arrived_user_count) = sql_select('SELECT count(*) AS `user_count` FROM `User` WHERE `Gekommen`=1');
$stats['arrived_user_count'] = $arrived_user_count['user_count'];
- $done_shifts_seconds = sql_select_single_cell("SELECT SUM(`Shifts`.`end` - `Shifts`.`start`) FROM `ShiftEntry` JOIN `Shifts` USING (`SID`) WHERE `Shifts`.`end` < UNIX_TIMESTAMP()");
+ $done_shifts_seconds = sql_select_single_cell('
+ SELECT SUM(`Shifts`.`end` - `Shifts`.`start`)
+ FROM `ShiftEntry`
+ JOIN `Shifts` USING (`SID`)
+ WHERE `Shifts`.`end` < UNIX_TIMESTAMP()
+ ');
$stats['done_work_hours'] = round($done_shifts_seconds / (60 * 60), 0);
- $users_in_action = sql_select("SELECT `Shifts`.`start`, `Shifts`.`end` FROM `ShiftEntry` JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID` WHERE UNIX_TIMESTAMP() BETWEEN `Shifts`.`start` AND `Shifts`.`end`");
+ $users_in_action = sql_select('
+ SELECT `Shifts`.`start`, `Shifts`.`end`
+ FROM `ShiftEntry`
+ JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID`
+ WHERE UNIX_TIMESTAMP() BETWEEN `Shifts`.`start` AND `Shifts`.`end`
+ ');
$stats['users_in_action'] = count($users_in_action);
- header("Content-Type: application/json");
+ header('Content-Type: application/json');
raw_output(json_encode($stats));
return;
}
raw_output(json_encode([
- 'error' => "Wrong api_key."
+ 'error' => 'Wrong api_key.'
]));
}
raw_output(json_encode([
- 'error' => "Missing parameter api_key."
+ 'error' => 'Missing parameter api_key.'
]));
}