forked from janek/mostr
fix(tasks): only enter a perfect global match that is not closed
This commit is contained in:
parent
1d7d3eea74
commit
714d4a4d5b
|
@ -286,6 +286,7 @@ impl Tasks {
|
||||||
.unwrap_or(String::new())
|
.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<EventId>) -> ParentIterator {
|
fn traverse_up_from(&self, id: Option<EventId>) -> ParentIterator {
|
||||||
ParentIterator {
|
ParentIterator {
|
||||||
tasks: &self.tasks,
|
tasks: &self.tasks,
|
||||||
|
@ -590,7 +591,9 @@ impl Tasks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for task in self.tasks.values() {
|
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];
|
return vec![task.event.id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue