Use a better variable name for stat disappear date

* Rename occurences of `last_week` with `minimum_to_exist`
This commit is contained in:
luukas 2022-05-25 14:49:17 +03:00
parent 4b707aa9d1
commit a937a94ac8
No known key found for this signature in database
GPG Key ID: CC4915E8D71FC044
3 changed files with 6 additions and 6 deletions

View File

@ -258,6 +258,6 @@ class Stats:
# delete old data # delete old data
max_age = self.helper.get_setting("history_max_age") max_age = self.helper.get_setting("history_max_age")
now = datetime.datetime.now() now = datetime.datetime.now()
last_week = now.day - max_age minimum_to_exist = now.day - max_age
HostStats.delete().where(HostStats.time < last_week).execute() HostStats.delete().where(HostStats.time < minimum_to_exist).execute()

View File

@ -176,9 +176,9 @@ class HelperServerStats:
).execute() ).execute()
@staticmethod @staticmethod
def remove_old_stats(server_id, last_week): def remove_old_stats(server_id, minimum_to_exist):
HelperServerStats.select_database(server_id) HelperServerStats.select_database(server_id)
ServerStats.delete().where(ServerStats.created < last_week).execute() ServerStats.delete().where(ServerStats.created < minimum_to_exist).execute()
@staticmethod @staticmethod
def get_latest_server_stats(server_id): def get_latest_server_stats(server_id):

View File

@ -1450,6 +1450,6 @@ class Server:
# delete old data # delete old data
max_age = self.helper.get_setting("history_max_age") max_age = self.helper.get_setting("history_max_age")
now = datetime.datetime.now() now = datetime.datetime.now()
last_week = now.day - max_age minimum_to_exist = now.day - max_age
HelperServerStats.remove_old_stats(server.get("id", 0), last_week) HelperServerStats.remove_old_stats(server.get("id", 0), minimum_to_exist)