summaryrefslogtreecommitdiff
path: root/prediction_controller.py
diff options
context:
space:
mode:
authormatin <matin.kaufmann@gmail.com>2025-09-30 15:13:08 +0200
committermatin <matin.kaufmann@gmail.com>2025-09-30 15:13:08 +0200
commit3054eb8c0de880655a3a01bf4c2da154e6c3ab42 (patch)
treec26f30d53156e52631897159385d3d776278b92f /prediction_controller.py
parent6de01b3ee171e60e6609aea51ef7c9056736a017 (diff)
save + load includes the launch date and duration. also, increased readability of the json output
Diffstat (limited to 'prediction_controller.py')
-rw-r--r--prediction_controller.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/prediction_controller.py b/prediction_controller.py
index 168ad62..e822f2e 100644
--- a/prediction_controller.py
+++ b/prediction_controller.py
@@ -241,4 +241,26 @@ class PredictionController:
if launch_dt > datetime(2100, 1, 1):
errors.append("Launch date too far in the future")
- return errors \ No newline at end of file
+ return errors
+
+ def save_complete_state(self, filename: str) -> bool:
+ """Save the complete prediction state including all calculated data"""
+ from prediction_state_service import PredictionStateService
+ return PredictionStateService.save_prediction_state(
+ self.calendar_manager, self, filename
+ )
+
+ def load_complete_state(self, filename: str) -> bool:
+ """Load complete prediction state and restore controller"""
+ from prediction_state_service import PredictionStateService
+
+ state = PredictionStateService.load_prediction_state(filename)
+ if state:
+ success = PredictionStateService.restore_from_state(
+ state, self.calendar_manager, self
+ )
+ if success and state.prediction_date:
+ # Restore prediction date directly if available
+ self.prediction = state.prediction_date
+ return success
+ return False \ No newline at end of file