From 08728d7d03ec8782f50fef3e097d51053146e63f Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 3 Jun 2025 10:44:15 +0200 Subject: [PATCH] UI - Realtime - Fixing 'last_changed' status re #3224 --- changedetectionio/realtime/socket_server.py | 13 +++++-------- changedetectionio/static/js/realtime.js | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/changedetectionio/realtime/socket_server.py b/changedetectionio/realtime/socket_server.py index c9241486..86396a1f 100644 --- a/changedetectionio/realtime/socket_server.py +++ b/changedetectionio/realtime/socket_server.py @@ -170,12 +170,10 @@ def handle_watch_update(socketio, **kwargs): error_texts = "" # Get the error texts from the watch error_texts = watch.compile_error_texts() - # Create a simplified watch data object to send to clients - watch_uuid = watch.get('uuid') - + watch_data = { - 'checking_now': True if watch_uuid in running_uuids else False, + 'checking_now': True if watch.get('uuid') in running_uuids else False, 'fetch_time': watch.get('fetch_time'), 'has_error': True if error_texts else False, 'last_changed': watch.get('last_changed'), @@ -183,13 +181,12 @@ def handle_watch_update(socketio, **kwargs): 'error_text': error_texts, 'history_n': watch.history_n, 'last_checked_text': _jinja2_filter_datetime(watch), - 'last_changed_text': timeago.format(int(watch['last_changed']), time.time()) if watch.history_n >= 2 and int( - watch.get('last_changed', 0)) > 0 else 'Not yet', - 'queued': True if watch_uuid in queue_list else False, + 'last_changed_text': timeago.format(int(watch.last_changed), time.time()) if watch.history_n >= 2 and int(watch.last_changed) > 0 else 'Not yet', + 'queued': True if watch.get('uuid') in queue_list else False, 'paused': True if watch.get('paused') else False, 'notification_muted': True if watch.get('notification_muted') else False, 'unviewed': watch.has_unviewed, - 'uuid': watch_uuid, + 'uuid': watch.get('uuid'), 'event_timestamp': time.time() } diff --git a/changedetectionio/static/js/realtime.js b/changedetectionio/static/js/realtime.js index 5f6984c9..9534db74 100644 --- a/changedetectionio/static/js/realtime.js +++ b/changedetectionio/static/js/realtime.js @@ -102,7 +102,7 @@ $(document).ready(function () { $('td.title-col .error-text', $watchRow).html(watch.error_text) - $('td.last-changed', $watchRow).text(watch.last_checked_text) + $('td.last-changed', $watchRow).text(watch.last_changed_text) $('td.last-checked .innertext', $watchRow).text(watch.last_checked_text) $('td.last-checked', $watchRow).data('timestamp', watch.last_checked).data('fetchduration', watch.fetch_time);