From e4191493784f07fb1024e7384b95b6ab9d714cca Mon Sep 17 00:00:00 2001 From: Joshi Date: Tue, 28 Jan 2020 16:27:30 -0800 Subject: [PATCH] Addresses comments - change function names, consolidate compute function --- src/plugins/condition/Condition.js | 8 ++---- .../condition/components/ConditionEdit.vue | 8 +++--- src/plugins/condition/utils/evaluator.js | 27 +++++-------------- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/plugins/condition/Condition.js b/src/plugins/condition/Condition.js index 6ff4a41b56..ab3bc0858d 100644 --- a/src/plugins/condition/Condition.js +++ b/src/plugins/condition/Condition.js @@ -24,7 +24,7 @@ import * as EventEmitter from 'eventemitter3'; import uuid from 'uuid'; import TelemetryCriterion from "@/plugins/condition/criterion/TelemetryCriterion"; import { TRIGGER } from "@/plugins/condition/utils/constants"; -import {computeConditionForAll, computeConditionForAny} from "@/plugins/condition/utils/evaluator"; +import {computeCondition} from "@/plugins/condition/utils/evaluator"; /* * conditionDefinition = { @@ -228,11 +228,7 @@ export default class ConditionClass extends EventEmitter { //TODO: implement as part of the evaluator class task. evaluate() { - if (this.trigger === TRIGGER.ANY) { - this.result = computeConditionForAny(this.criteriaResults); - } else if (this.trigger === TRIGGER.ALL) { - this.result = computeConditionForAll(this.criteriaResults); - } + this.result = computeCondition(this.criteriaResults, this.trigger === TRIGGER.ALL); } emitEvent(eventName, data) { diff --git a/src/plugins/condition/components/ConditionEdit.vue b/src/plugins/condition/components/ConditionEdit.vue index d4625aed5c..a6b821999c 100644 --- a/src/plugins/condition/components/ConditionEdit.vue +++ b/src/plugins/condition/components/ConditionEdit.vue @@ -89,7 +89,7 @@