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/ConditionSpec.js b/src/plugins/condition/ConditionSpec.js index 57d50abf9b..18334bcada 100644 --- a/src/plugins/condition/ConditionSpec.js +++ b/src/plugins/condition/ConditionSpec.js @@ -65,7 +65,7 @@ describe("The condition", function () { testConditionDefinition = { definition: { - trigger: 'any', + trigger: TRIGGER.ANY, criteria: [ { operation: 'equalTo', @@ -103,7 +103,6 @@ describe("The condition", function () { it("initializes with criteria from the condition definition", function () { expect(conditionObj.criteria.length).toEqual(1); let criterion = conditionObj.criteria[0]; - console.log(criterion); expect(criterion instanceof TelemetryCriterion).toBeTrue(); expect(criterion.operator).toEqual(testConditionDefinition.definition.criteria[0].operator); expect(criterion.input).toEqual(testConditionDefinition.definition.criteria[0].input); diff --git a/src/plugins/condition/components/ConditionEdit.vue b/src/plugins/condition/components/ConditionEdit.vue index a5dc04ca3e..a13115b0ca 100644 --- a/src/plugins/condition/components/ConditionEdit.vue +++ b/src/plugins/condition/components/ConditionEdit.vue @@ -85,17 +85,23 @@ +<<<<<<< HEAD