From 584d907356c566eac2b8f1227a63dee85bd27b3a Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 9 May 2025 17:34:21 +0200 Subject: [PATCH] refactor(tasks): inline get_position_timestamped method --- src/tasks.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/tasks.rs b/src/tasks.rs index 69f5171..488cbc6 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -244,12 +244,8 @@ impl TasksRelay { self.get_position_at(now()).1 } - pub(crate) fn get_position_timestamped(&self) -> (Timestamp, Option) { - self.get_position_at(now()) - } - pub(super) fn parse_tracking_stamp_relative(&self, input: &str) -> Option { - let pos = self.get_position_timestamped(); + let pos = self.get_position_at(now()); let mut pos_time = pos.1.and_then(|_| Local.timestamp_opt(pos.0.as_u64() as i64, 0).earliest()); parse_tracking_stamp(input, pos_time.take_if(|t| Local::now() - *t > TimeDelta::hours(6))) } @@ -263,6 +259,7 @@ impl TasksRelay { // TODO binary search /// Gets last position change before the given timestamp + /// Returns the position together with when it was set fn get_position_at(&self, timestamp: Timestamp) -> (Timestamp, Option) { self.history_from(timestamp) .last()