Smart rules: Change operator to `OR` by default (#7)
This commit is contained in:
parent
79180b1024
commit
4b11843916
|
|
@ -42,7 +42,7 @@ export function CreateAutomationRuleDialog({
|
|||
const [priority, setPriority] = useState('10');
|
||||
const [ruleStructure, setRuleStructure] = useState<RuleStructure>({
|
||||
groups: [createEmptyGroup()],
|
||||
groupOperator: 'and',
|
||||
groupOperator: 'or',
|
||||
});
|
||||
const [categoryId, setCategoryId] = useState<string>('');
|
||||
const [note, setNote] = useState('');
|
||||
|
|
|
|||
|
|
@ -218,11 +218,11 @@ export function parseJsonLogic(jsonLogic: JsonLogicRule): RuleStructure {
|
|||
groups: [
|
||||
{
|
||||
id: crypto.randomUUID(),
|
||||
operator: 'and',
|
||||
operator: 'or',
|
||||
conditions: [],
|
||||
},
|
||||
],
|
||||
groupOperator: 'and',
|
||||
groupOperator: 'or',
|
||||
};
|
||||
|
||||
if (!jsonLogic || Object.keys(jsonLogic).length === 0) {
|
||||
|
|
@ -310,7 +310,7 @@ export function parseJsonLogic(jsonLogic: JsonLogicRule): RuleStructure {
|
|||
: defaultStructure.groups[0].conditions,
|
||||
},
|
||||
],
|
||||
groupOperator: 'and',
|
||||
groupOperator: 'or',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -321,11 +321,11 @@ export function parseJsonLogic(jsonLogic: JsonLogicRule): RuleStructure {
|
|||
groups: [
|
||||
{
|
||||
id: crypto.randomUUID(),
|
||||
operator: 'and',
|
||||
operator: 'or',
|
||||
conditions: [parsed],
|
||||
},
|
||||
],
|
||||
groupOperator: 'and',
|
||||
groupOperator: 'or',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ export function createEmptyCondition(): Condition {
|
|||
export function createEmptyGroup(): ConditionGroup {
|
||||
return {
|
||||
id: crypto.randomUUID(),
|
||||
operator: 'and',
|
||||
operator: 'or',
|
||||
conditions: [createEmptyCondition()],
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue