Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

flip arg order for comparator functions (inputValue, choiceValue) #363

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/stateTasks/executors/ChoiceExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,31 @@ export class ChoiceExecutor extends StateTypeExecutor {

// TODO: Find a better way to map the comparators with the methods without using factories or strategy
switch (comparator) {
case "IsPresent":
return choiceValue ? inputValue !== undefined : inputValue === undefined;
case 'BooleanEquals':
case 'NumericEquals':
case 'StringEquals':
case 'TimestampEquals':
return this.checkEquals(choiceValue, inputValue);
return this.checkEquals(inputValue, choiceValue);
case 'NumericGreaterThan':
case 'StringGreaterThan':
case 'TimestampGreaterThan':
return this.checkGreaterThan(choiceValue, inputValue);
return this.checkGreaterThan(inputValue, choiceValue);
case 'NumericGreaterThanEquals':
case 'StringGreaterThanEquals':
case 'TimestampGreaterThanEquals':
return this.checkGreaterThanEquals(choiceValue, inputValue);
return this.checkGreaterThanEquals(inputValue, choiceValue);
case 'NumericLessThan':
case 'StringLessThan':
case 'TimestampLessThan':
return this.checkLowerThan(choiceValue, inputValue);
return this.checkLowerThan(inputValue, choiceValue);
case 'NumericLessThanEquals':
case 'StringLessThanEquals':
case 'TimestampLessThanEquals':
return this.checkLowerThanEquals(choiceValue, inputValue);
return this.checkLowerThanEquals(inputValue, choiceValue);
default:
throw new Error();
throw new Error(`Comparator ${comparator} not implemented`);
}
}

Expand Down