fix event require input
This commit is contained in:
+2
-28
@@ -75,36 +75,10 @@ export function resolvePointRuleAction(rule: PointRule): PointAction | undefined
|
||||
}
|
||||
|
||||
function resolvePointValueRuleConfig(rule: PointRule): SourceValueConfig | undefined {
|
||||
if (rule.status !== "ACTIVE") {
|
||||
if (rule.status !== "ACTIVE" || rule.triggerType !== "SOURCE_VALUE" || rule.pointMode !== "SOURCE_VALUE") {
|
||||
return undefined;
|
||||
}
|
||||
if (rule.pointMode === "FIXED") {
|
||||
return resolveFixedPointValueRuleConfig(rule);
|
||||
}
|
||||
if (rule.triggerType === "SOURCE_VALUE" && rule.pointMode === "SOURCE_VALUE") {
|
||||
return resolveSourceValueRuleConfig(rule);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function resolveFixedPointValueRuleConfig(rule: PointRule): SourceValueConfig | undefined {
|
||||
const action = resolvePointRuleAction(rule);
|
||||
const pointValue = rule.pointValue;
|
||||
if (
|
||||
action === undefined
|
||||
|| pointValue === undefined
|
||||
|| pointValue === null
|
||||
|| !Number.isSafeInteger(pointValue)
|
||||
|| pointValue === 0
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const value = Math.abs(pointValue);
|
||||
return {
|
||||
action,
|
||||
range: [value, value]
|
||||
};
|
||||
return resolveSourceValueRuleConfig(rule);
|
||||
}
|
||||
|
||||
function resolveSourceValueRuleConfig(rule: PointRule): SourceValueConfig | undefined {
|
||||
|
||||
Reference in New Issue
Block a user