Fix empty preconditions not firing
This commit is contained in:
1 parent
e57d73267e
commit
9ba078870a
1 file changed
+10
-8
+10
-8
@@ -158,15 +158,17 @@ async function fetchPresets(): Promise<Preset[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const events = preset["events"] || {};
|
const events = preset["events"] || {};
|
||||||
let precondition;
|
let precondition = true as Expression;
|
||||||
try {
|
if (preset["precondition"]) {
|
||||||
precondition = parse(preset["precondition"]);
|
try {
|
||||||
} catch (error) {
|
precondition = parse(preset["precondition"]);
|
||||||
precondition = mongoQueryToFilter(JSON.parse(preset["precondition"]));
|
} catch (error) {
|
||||||
}
|
precondition = mongoQueryToFilter(JSON.parse(preset["precondition"]));
|
||||||
|
}
|
||||||
|
|
||||||
// Simplify expression
|
// Simplify expression
|
||||||
precondition = expression.evaluate(precondition);
|
precondition = expression.evaluate(precondition);
|
||||||
|
}
|
||||||
|
|
||||||
const _provisions = preset["provisions"] || [];
|
const _provisions = preset["provisions"] || [];
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user