mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-06 17:15:38 -08:00
BE: TZ timestamp work #1251
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -223,13 +223,12 @@ class plugin_manager:
|
||||
sql.execute("""
|
||||
SELECT MAX(DateTimeChanged) AS last_changed,
|
||||
COUNT(*) AS total_objects,
|
||||
SUM(CASE WHEN DateTimeCreated = DateTimeChanged THEN 1 ELSE 0 END) AS new_objects,
|
||||
CURRENT_TIMESTAMP AS state_updated
|
||||
SUM(CASE WHEN DateTimeCreated = DateTimeChanged THEN 1 ELSE 0 END) AS new_objects
|
||||
FROM Plugins_Objects
|
||||
WHERE Plugin = ?
|
||||
""", (plugin_name,))
|
||||
row = sql.fetchone()
|
||||
last_changed, total_objects, new_objects, state_updated = row if row else ("", 0, 0, "")
|
||||
last_changed, total_objects, new_objects, state_updated = row if row else ("", 0, 0)
|
||||
new_objects = new_objects or 0 # ensure it's int
|
||||
changed_objects = total_objects - new_objects
|
||||
|
||||
@@ -238,7 +237,7 @@ class plugin_manager:
|
||||
"totalObjects": total_objects or 0,
|
||||
"newObjects": new_objects or 0,
|
||||
"changedObjects": changed_objects or 0,
|
||||
"stateUpdated": state_updated or ""
|
||||
"stateUpdated": timeNowTZ()
|
||||
}
|
||||
|
||||
# Save in memory
|
||||
@@ -249,8 +248,7 @@ class plugin_manager:
|
||||
SELECT Plugin,
|
||||
MAX(DateTimeChanged) AS last_changed,
|
||||
COUNT(*) AS total_objects,
|
||||
SUM(CASE WHEN DateTimeCreated = DateTimeChanged THEN 1 ELSE 0 END) AS new_objects,
|
||||
CURRENT_TIMESTAMP AS state_updated
|
||||
SUM(CASE WHEN DateTimeCreated = DateTimeChanged THEN 1 ELSE 0 END) AS new_objects
|
||||
FROM Plugins_Objects
|
||||
GROUP BY Plugin
|
||||
""")
|
||||
@@ -262,7 +260,7 @@ class plugin_manager:
|
||||
"totalObjects": total_objects or 0,
|
||||
"newObjects": new_objects or 0,
|
||||
"changedObjects": changed_objects or 0,
|
||||
"stateUpdated": state_updated or ""
|
||||
"stateUpdated": timeNowTZ()
|
||||
}
|
||||
|
||||
# Save in memory
|
||||
|
||||
@@ -645,10 +645,7 @@ def update_devices_names(pm):
|
||||
|
||||
# --- Step 3: Log last checked time ---
|
||||
# After resolving names, update last checked
|
||||
sql = pm.db.sql
|
||||
sql.execute("SELECT CURRENT_TIMESTAMP")
|
||||
row = sql.fetchone()
|
||||
pm.name_plugins_checked = row[0] if row else None
|
||||
pm.name_plugins_checked = timeNowTZ()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Updates devPresentLastScan for parent devices based on the presence of their NICs
|
||||
|
||||
Reference in New Issue
Block a user