summaryrefslogtreecommitdiffstats
path: root/src/app/query.rs
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-08-25 03:36:29 -0400
committerGitHub <noreply@github.com>2020-08-25 03:36:29 -0400
commit9158c5f6d52a524851e033b0a3fdf6ffb3148af2 (patch)
tree17cb10f4d0848884b642a9fa9728ab8673475ca4 /src/app/query.rs
parente08eda8edc23bad505fdb568dcf6005755991710 (diff)
bug: fix grouping being broken after refactor (#201)0.4.6
Fixes grouping not working properly after some refactoring done in 0.4.6.
Diffstat (limited to 'src/app/query.rs')
-rw-r--r--src/app/query.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/app/query.rs b/src/app/query.rs
index fcff1d0d..25e3f409 100644
--- a/src/app/query.rs
+++ b/src/app/query.rs
@@ -459,8 +459,10 @@ impl Query {
Ok(())
}
- pub fn check(&self, process: &ConvertedProcessData) -> bool {
- self.query.iter().all(|ok| ok.check(process))
+ pub fn check(&self, process: &ConvertedProcessData, is_using_command: bool) -> bool {
+ self.query
+ .iter()
+ .all(|ok| ok.check(process, is_using_command))
}
}
@@ -497,11 +499,11 @@ impl Or {
Ok(())
}
- pub fn check(&self, process: &ConvertedProcessData) -> bool {
+ pub fn check(&self, process: &ConvertedProcessData, is_using_command: bool) -> bool {
if let Some(rhs) = &self.rhs {
- self.lhs.check(process) || rhs.check(process)
+ self.lhs.check(process, is_using_command) || rhs.check(process, is_using_command)
} else {
- self.lhs.check(process)
+ self.lhs.check(process, is_using_command)
}
}
}
@@ -542,11 +544,11 @@ impl And {
Ok(())
}
- pub fn check(&self, process: &ConvertedProcessData) -> bool {
+ pub fn check(&self, process: &ConvertedProcessData, is_using_command: bool) -> bool {
if let Some(rhs) = &self.rhs {
- self.lhs.check(process) && rhs.check(process)
+ self.lhs.check(process, is_using_command) && rhs.check(process, is_using_command)
} else {
- self.lhs.check(process)
+ self.lhs.check(process, is_using_command)
}
}
}
@@ -651,7 +653,7 @@ impl Prefix {
Ok(())
}
- pub fn check(&self, process: &ConvertedProcessData) -> bool {
+ pub fn check(&self, process: &ConvertedProcessData, is_using_command: bool) -> bool {
fn matches_condition(condition: &QueryComparison, lhs: f64, rhs: f64) -> bool {
match condition {
QueryComparison::Equal => (lhs - rhs).abs() < std::f64::EPSILON,
@@ -663,7 +665,7 @@ impl Prefix {
}
if let Some(and) = &self.or {
- and.check(process)
+ and.check(process, is_using_command)
} else if let Some((prefix_type, query_content)) = &self.regex_prefix {
if let StringQuery::Regex(r) = query_content {
match prefix_type {