mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-31 12:56:11 +01:00
Delete audit logs when they exceed 300 entries
This commit is contained in:
parent
7889ca3153
commit
184a042e2a
@ -195,7 +195,7 @@ class helpers_management:
|
|||||||
#deletes records when they're more than 100
|
#deletes records when they're more than 100
|
||||||
ordered = Audit_Log.select().order_by(+Audit_Log.created)
|
ordered = Audit_Log.select().order_by(+Audit_Log.created)
|
||||||
for item in ordered:
|
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()
|
Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute()
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
@ -212,7 +212,7 @@ class helpers_management:
|
|||||||
#deletes records when they're more than 100
|
#deletes records when they're more than 100
|
||||||
ordered = Audit_Log.select().order_by(+Audit_Log.created)
|
ordered = Audit_Log.select().order_by(+Audit_Log.created)
|
||||||
for item in ordered:
|
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()
|
Audit_Log.delete().where(Audit_Log.audit_id == item.audit_id).execute()
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user