From 9e74992bcc1aaa106f18f221e990e47db509560e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 10 Jan 2026 03:15:06 +0000 Subject: [PATCH] Fix: Add load_session method to Api class This commit adds the missing `load_session` method to the `Api` class in `main.py`. This method is required by the frontend to restore the previous session state on startup. It delegates the operation to the `SessionManager`. - Added `load_session` to `main.py` - Added error handling and logging for session loading --- main.py | 9 +++++++++ tests/saved_sessions/test_session.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d6b4614..15bba3e 100644 --- a/main.py +++ b/main.py @@ -77,6 +77,15 @@ def save_session(self, groups_json, prefs_json): print(f"[Api] Save Error: {e}") return False + def load_session(self, filename): + print(f"[Api] Loading session: {filename}") + try: + data = self.session_manager.load_session(filename) + return data + except Exception as e: + print(f"[Api] Load Error: {e}") + return None + if __name__ == "__main__": api = Api() diff --git a/tests/saved_sessions/test_session.json b/tests/saved_sessions/test_session.json index ce9924b..70f8a47 100644 --- a/tests/saved_sessions/test_session.json +++ b/tests/saved_sessions/test_session.json @@ -1,5 +1,5 @@ { - "timestamp": "2026-01-09T12:26:45.250661", + "timestamp": "2026-01-10T03:13:56.284795", "groups": [ { "id": 1,