mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 01:35:28 +01:00
Changing history units to hours
This commit is contained in:
parent
99ef2db016
commit
e9439ca154
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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():
|
||||
|
Loading…
x
Reference in New Issue
Block a user