mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Use a better variable name for stat disappear date
* Rename occurences of `last_week` with `minimum_to_exist`
This commit is contained in:
parent
4b707aa9d1
commit
a937a94ac8
@ -258,6 +258,6 @@ class Stats:
|
||||
# delete old data
|
||||
max_age = self.helper.get_setting("history_max_age")
|
||||
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()
|
||||
|
@ -176,9 +176,9 @@ class HelperServerStats:
|
||||
).execute()
|
||||
|
||||
@staticmethod
|
||||
def remove_old_stats(server_id, last_week):
|
||||
def remove_old_stats(server_id, minimum_to_exist):
|
||||
HelperServerStats.select_database(server_id)
|
||||
ServerStats.delete().where(ServerStats.created < last_week).execute()
|
||||
ServerStats.delete().where(ServerStats.created < minimum_to_exist).execute()
|
||||
|
||||
@staticmethod
|
||||
def get_latest_server_stats(server_id):
|
||||
|
@ -1450,6 +1450,6 @@ class Server:
|
||||
# delete old data
|
||||
max_age = self.helper.get_setting("history_max_age")
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user