Merge branch 'pretzel-fixes' of https://gitlab.com/crafty-controller/crafty-commander into pretzel-fixes

This commit is contained in:
Andrew 2022-01-29 16:38:16 -05:00
commit 7aebd8bd5b

View File

@ -192,6 +192,14 @@ class helpers_management:
Audit_Log.log_msg: audit_msg,
Audit_Log.source_ip: source_ip
}).execute()
#todo make this user configurable
#deletes records when they're more than 100
ordered = Audit_Log.select().order_by(+Audit_Log.created)
for item in ordered:
if Audit_Log.select().count() > 300:
Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute()
else:
return
@staticmethod
def add_to_audit_log_raw(user_name, user_id, server_id, log_msg, source_ip):
@ -202,7 +210,13 @@ class helpers_management:
Audit_Log.log_msg: log_msg,
Audit_Log.source_ip: source_ip
}).execute()
#deletes records when they're more than 100
ordered = Audit_Log.select().order_by(+Audit_Log.created)
for item in ordered:
if Audit_Log.select().count() > 300:
Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute()
else:
return
#************************************************************************************************
# Schedules Methods
#************************************************************************************************