diff --git a/app/classes/controllers/servers_controller.py b/app/classes/controllers/servers_controller.py index ca6c8d22..c0bae7b0 100644 --- a/app/classes/controllers/servers_controller.py +++ b/app/classes/controllers/servers_controller.py @@ -105,9 +105,9 @@ class ServersController(metaclass=Singleton): return ret - def get_history_stats(self, server_id, days): + def get_history_stats(self, server_id, hours): srv = ServersController().get_server_instance_by_id(server_id) - return srv.stats_helper.get_history_stats(server_id, days) + return srv.stats_helper.get_history_stats(server_id, hours) @staticmethod def update_unloaded_server(server_obj): diff --git a/app/classes/models/server_stats.py b/app/classes/models/server_stats.py index 5a38ac1e..f2bcec62 100644 --- a/app/classes/models/server_stats.py +++ b/app/classes/models/server_stats.py @@ -142,9 +142,9 @@ class HelperServerStats: self.database.close() return server_data - def get_history_stats(self, server_id, num_days): + def get_history_stats(self, server_id, num_hours): self.database.connect(reuse_if_open=True) - max_age = datetime.datetime.now() - timedelta(days=num_days) + max_age = datetime.datetime.now() - timedelta(hours=num_hours) query_stats = ( ServerStats.select() .where(ServerStats.created > max_age) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 59465838..8205bd8a 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -1814,5 +1814,5 @@ class ServerInstance: self.stats_helper.remove_old_stats(minimum_to_exist) def get_server_history(self): - history = self.stats_helper.get_history_stats(self.server_id, 3) + history = self.stats_helper.get_history_stats(self.server_id, 1) return history diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 696da799..760e0298 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -747,7 +747,7 @@ class PanelHandler(BaseHandler): 0, page_data["options"].pop(page_data["options"].index(days)) ) page_data["history_stats"] = self.controller.servers.get_history_stats( - server_id, days + server_id, hours=(days * 24) ) def get_banned_players_html():