From 3fa8df4eaa3af31bcc69aa2bdcbd97cd12b73c40 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 12 Nov 2024 20:23:30 +0100 Subject: [PATCH] feat(tasks): add high priority tasks to quick access --- src/tasks.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tasks.rs b/src/tasks.rs index e2a3caa..b80d120 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -1232,7 +1232,18 @@ impl Display for TasksRelay { let mut bookmarks = // TODO add recent tasks (most time tracked + recently created) self.bookmarks.iter() - .chain(self.tasks.values().sorted_unstable().take(3).map(|t| t.get_id())) + .chain( + // Latest + self.tasks.values() + .sorted_unstable().rev() + .take(3).map(|t| t.get_id())) + .chain( + // Highest Prio + self.tasks.values() + .filter_map(|t| t.priority().filter(|p| *p > 35).map(|p| (p, t))) + .sorted_unstable() + .take(3).map(|(_, t)| t.get_id()) + ) .filter(|id| !ids.contains(id)) .filter_map(|id| self.get_by_id(id)) .filter(|t| self.filter(t))