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"] || {};
|
||||
let precondition;
|
||||
try {
|
||||
precondition = parse(preset["precondition"]);
|
||||
} catch (error) {
|
||||
precondition = mongoQueryToFilter(JSON.parse(preset["precondition"]));
|
||||
}
|
||||
let precondition = true as Expression;
|
||||
if (preset["precondition"]) {
|
||||
try {
|
||||
precondition = parse(preset["precondition"]);
|
||||
} catch (error) {
|
||||
precondition = mongoQueryToFilter(JSON.parse(preset["precondition"]));
|
||||
}
|
||||
|
||||
// Simplify expression
|
||||
precondition = expression.evaluate(precondition);
|
||||
// Simplify expression
|
||||
precondition = expression.evaluate(precondition);
|
||||
}
|
||||
|
||||
const _provisions = preset["provisions"] || [];
|
||||
|
||||
|
||||
Reference in new issue
Block a user