cleanup guest stats
This commit is contained in:
parent
79588ff2cf
commit
54e6f422ce
|
@ -16,15 +16,20 @@ function guest_stats() {
|
||||||
$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);
|
$stats['done_work_hours'] = round($done_shifts_seconds / (60 * 60), 0);
|
||||||
|
|
||||||
$users_in_action_source = 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_source);
|
$stats['users_in_action'] = count($users_in_action);
|
||||||
|
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
die(json_encode($stats));
|
raw_output(json_encode($stats));
|
||||||
} else die(json_encode(array('error' => "Wrong api_key.")));
|
return;
|
||||||
} else die(json_encode(array('error' => "Missing parameter api_key.")));
|
}
|
||||||
|
raw_output(json_encode([
|
||||||
|
'error' => "Wrong api_key."
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
raw_output(json_encode([
|
||||||
|
'error' => "Missing parameter api_key."
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue