automatyzacje-comit1
This commit is contained in:
@@ -94,6 +94,14 @@ def list_history(profile_id: int, user_id: int | None = None, limit: int = 30) -
|
||||
return conn.execute('SELECT * FROM automation_history WHERE user_id=? AND profile_id=? ORDER BY created_at DESC LIMIT ?', (user_id, profile_id, max(1, min(int(limit or 30), 100)))).fetchall()
|
||||
|
||||
|
||||
def clear_history(profile_id: int, user_id: int | None = None) -> int:
|
||||
user_id = user_id or default_user_id()
|
||||
with connect() as conn:
|
||||
# Note: Manual automation log cleanup is scoped to the active profile and current user.
|
||||
cur = conn.execute('DELETE FROM automation_history WHERE user_id=? AND profile_id=?', (user_id, profile_id))
|
||||
return int(cur.rowcount or 0)
|
||||
|
||||
|
||||
def _condition_true(t: dict[str, Any], cond: dict[str, Any]) -> bool:
|
||||
typ = str(cond.get('type') or '')
|
||||
if typ == 'completed': return bool(int(t.get('complete') or 0))
|
||||
|
||||
Reference in New Issue
Block a user