From 0e48f3310b5738dd0751ab151d12dbf1baab1339 Mon Sep 17 00:00:00 2001 From: Mike Rosseel Date: Fri, 20 Mar 2026 01:55:51 +0100 Subject: [PATCH] fix: update observed filter cache after logging an observation The observed_objects_cache was only populated at startup. Logging an observation during a session did not update the cache or the CompositeObject.logged flag, so filtering by "observed/not observed" gave stale results within the same session. Co-Authored-By: Claude Opus 4.6 --- python/PiFinder/db/observations_db.py | 4 ++++ python/PiFinder/ui/log.py | 1 + 2 files changed, 5 insertions(+) diff --git a/python/PiFinder/db/observations_db.py b/python/PiFinder/db/observations_db.py index 76df34987..e0fc8d6a9 100644 --- a/python/PiFinder/db/observations_db.py +++ b/python/PiFinder/db/observations_db.py @@ -121,6 +121,10 @@ def log_object(self, session_uuid, obs_time, catalog, sequence, solution, notes) ) self.conn.commit() + # Update cache so filters reflect the new observation immediately + if (catalog, sequence) not in self.observed_objects_cache: + self.observed_objects_cache.append((catalog, sequence)) + observation_id = self.cursor.execute( "select last_insert_rowid() as id" ).fetchone()["id"] diff --git a/python/PiFinder/ui/log.py b/python/PiFinder/ui/log.py index a095aca17..c07b4a805 100644 --- a/python/PiFinder/ui/log.py +++ b/python/PiFinder/ui/log.py @@ -282,6 +282,7 @@ def record_object(self): solution=self.shared_state.solution(), notes=notes, ) + self.object.logged = True self.reset_config() def key_number(self, number: int):