BE: spinner + timestamp work #1251

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2025-11-02 22:12:30 +11:00
parent a27ee5c2f2
commit 7c90c2e93c
2 changed files with 10 additions and 8 deletions

View File

@@ -35,7 +35,7 @@ class app_state_class:
def __init__(self, currentState=None,
settingsSaved=None,
settingsImported=None,
showSpinner=False,
showSpinner=None,
graphQLServerStarted=0,
processScan=False,
pluginsStates=None):
@@ -150,7 +150,7 @@ class app_state_class:
def updateState(newState = None,
settingsSaved = None,
settingsImported = None,
showSpinner = False,
showSpinner = None,
graphQLServerStarted = None,
processScan = None,
pluginsStates=None):

View File

@@ -532,12 +532,14 @@ def update_devices_names(pm):
last_checked_str = pm.name_plugins_checked
last_checked_dt = parser.parse(last_checked_str) if isinstance(last_checked_str, str) else last_checked_str
# Find the most recent plugin update time among name-related plugins
state_times = [
pm.plugin_states.get(p, {}).get("stateUpdated")
for p in name_plugins
if pm.plugin_states.get(p)
]
# Collect valid state update timestamps for name-related plugins
state_times = []
for p in name_plugins:
state_updated = pm.plugin_states.get(p, {}).get("stateUpdated")
if state_updated and state_updated.strip(): # skip empty or None
state_times.append(state_updated)
# Determine the latest valid stateUpdated timestamp
latest_state_str = max(state_times, default=None)
latest_state_dt = parser.parse(latest_state_str) if latest_state_str else None