From 156cbfe2b0383521f540109682d98d35c88d65f8 Mon Sep 17 00:00:00 2001 From: tslil Date: Tue, 14 Jul 2026 12:20:44 +0100 Subject: don't cache album list, use compression only on json for ease of inspection --- src/trajectory.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/trajectory.rs') diff --git a/src/trajectory.rs b/src/trajectory.rs index cbb0661..7f41a65 100644 --- a/src/trajectory.rs +++ b/src/trajectory.rs @@ -1,5 +1,5 @@ use serde::{Deserialize, Serialize}; -use std::{collections::HashSet, time::SystemTime}; +use std::time::SystemTime; use crate::learner::Learning; @@ -36,16 +36,6 @@ impl From> for Action { } impl Trajectory { - pub fn prune(&mut self, valid: &HashSet) { - self.history.retain_mut(|x| valid.contains(x)); - - if let Some(ref last_data) = self.last_data - && !valid.contains(&last_data.album) - { - self.last_data = None - } - } - pub fn slice(&self) -> &[String] { &self.history } @@ -54,7 +44,7 @@ impl Trajectory { self.last_data = Some(LastData { timestamp: SystemTime::now(), album: new_album.to_string(), - }) + }); } pub fn step(&mut self, skip_window_secs: u64) -> Option { @@ -74,8 +64,7 @@ impl Trajectory { let learnt_nothing = self .streak_kind .as_ref() - .map(|kind| *kind == action) - .unwrap_or(false); + .is_some_and(|kind| *kind == action); let learning = match (learnt_nothing, &action) { (false, Action::Skip) => { @@ -89,7 +78,7 @@ impl Trajectory { if !learnt_nothing { self.history.clear(); - }; + } self.history.push(last_album); self.streak_kind = Some(action); -- cgit v1.2.3