Delete audit logs when they exceed 300 entries

This commit is contained in:
Andrew 2022-01-29 01:37:28 -05:00
parent 7889ca3153
commit 184a042e2a

View File

@ -195,7 +195,7 @@ class helpers_management:
#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() > 100:
if Audit_Log.select().count() > 300:
Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute()
else:
return
@ -212,7 +212,7 @@ class helpers_management:
#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() > 100:
if Audit_Log.select().count() > 300:
Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute()
else:
return