From a34dc183811007db550d0144a6dbbe2357fbcaf6 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 13 Oct 2025 16:31:15 +0200 Subject: [PATCH] implemented load_day & list_day_in_timespan in IDStore --- src/store/id_store.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/store/id_store.rs b/src/store/id_store.rs index cc94a78..0c07cf4 100644 --- a/src/store/id_store.rs +++ b/src/store/id_store.rs @@ -90,4 +90,23 @@ impl IDStore { } changed } + + /// Load and return a AttendanceDay. Nothing more. Nothing less. + pub async fn load_day(&mut self, day: Day) -> Option { + if day == self.current_day.date { + return Some(self.current_day.clone()); + } + + self.persistence_layer.load_day(day).await + } + + pub async fn list_days_in_timespan(&mut self, from: Day, to: Day) -> Vec { + let all_days = self.persistence_layer.list_days().await; + + all_days + .into_iter() + .filter(|e| *e >= from) + .filter(|e| *e <= to) + .collect() + } }