From 01ece3b2afdbca3da257518814d36aeba81f2d0e Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sun, 25 Aug 2024 16:46:21 +0300 Subject: [PATCH] fix(tasks): only enter a perfect global match that is not closed --- src/tasks.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tasks.rs b/src/tasks.rs index 9a319c7..d25bf8d 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -286,6 +286,7 @@ impl Tasks { .unwrap_or(String::new()) } + /// Iterate over the task referenced by the given id and all its available parents. fn traverse_up_from(&self, id: Option) -> ParentIterator { ParentIterator { tasks: &self.tasks, @@ -590,7 +591,9 @@ impl Tasks { } } for task in self.tasks.values() { - if task.event.content.to_ascii_lowercase() == lowercase_arg { + if task.event.content.to_ascii_lowercase() == lowercase_arg && + !self.traverse_up_from(Some(*task.get_id())).any(|t| t.pure_state() == State::Closed) { + // exclude closed tasks and their subtasks return vec![task.event.id]; } }