returnjdbcTemplate_ro.query("SELECT avg(`player_count`) as player_count, FROM_UNIXTIME(`utime`) as fulldate, `utime` as ts FROM `servers_online` WHERE `player_count` != 0 and `server_id` like ? GROUP BY FROM_UNIXTIME(`utime`) div ? ORDER BY `ts` ASC",
returnjdbcTemplate_ro.query("SELECT avg(`player_count`) as player_count, FROM_UNIXTIME(`utime`) as fulldate, `utime` as ts FROM `servers_online` WHERE `player_count` != 0 and `server_id` like ? GROUP BY FROM_UNIXTIME(`utime`) div ? ORDER BY `ts` ASC",
//CREATE TABLE `tf2.facti13`.`servers_online` (`id` INT NOT NULL AUTO_INCREMENT , `utime` INT NOT NULL , `player_count` INT NOT NULL , `max_players` INT NOT NULL , `server_id` VARCHAR(32) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
publicclassServerOnline{
privateintid;
@ -64,4 +82,48 @@ public class OnlineUpdater extends BaseUpdater {
privateintmax_players;
privateStringserver_id;
}
//stats per 5 = '500' minutes
//SELECT avg(`player_count`) as player_count, FROM_UNIXTIME(`utime`) as fulldate, `utime` as ts FROM `servers_online` WHERE `server_id` like 'srv5' and FROM_UNIXTIME(`utime`) > CAST(DATE_FORMAT(NOW() ,'%Y-%m-26') as DATE) GROUP BY FROM_UNIXTIME(`utime`) div 500 ORDER BY `ts` ASC;
//SELECT avg(`player_count`) as player_count, FROM_UNIXTIME(`utime`) as fulldate, `utime` as ts FROM `servers_online` WHERE `player_count` != 0 and `server_id` like 'srv5' GROUP BY FROM_UNIXTIME(`utime`) div 800000 ORDER BY `ts` ASC;