forked from janek/mostr
1
0
Fork 0

feat(tasks): add high priority tasks to quick access

This commit is contained in:
xeruf 2024-11-12 20:23:30 +01:00
parent b9f1d461fb
commit 3fa8df4eaa
1 changed files with 12 additions and 1 deletions

View File

@ -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))