직접입력 평가로직 오류
This commit is contained in:
@@ -101,6 +101,7 @@ import {
|
||||
THRESHOLD_HL_MID,
|
||||
THRESHOLD_HL_OVER,
|
||||
THRESHOLD_HL_UNDER,
|
||||
defaultThresholdForRole,
|
||||
isThresholdFieldOrSymbol,
|
||||
isThresholdSymbol,
|
||||
resolveInheritedThresholdField,
|
||||
@@ -846,11 +847,16 @@ export const applyCondTypeDefaults = (cond: ConditionDSL, newCondType: string, D
|
||||
}
|
||||
const fieldOpts = getFieldOpts(cond.indicatorType, 'buy', DEF);
|
||||
const isValid = (v: string|undefined) => !!v && fieldOpts.some(o => o.value === v);
|
||||
const isValidRight = (v: string|undefined) => {
|
||||
if (!v) return false;
|
||||
if (isThresholdOverridden(cond) && (v.startsWith('K_') || isThresholdSymbol(v))) return true;
|
||||
return isValid(v);
|
||||
};
|
||||
const def = getDefaultConditionFields(cond.indicatorType, 'buy', DEF);
|
||||
|
||||
if (['GT','LT','GTE','LTE','EQ','NEQ','CROSS_UP','CROSS_DOWN','DIFF_GT','DIFF_LT'].includes(newCondType)) {
|
||||
if (!isValid(updated.leftField)) updated.leftField = def.l;
|
||||
if (!isValid(updated.rightField)) updated.rightField = def.r;
|
||||
if (!isValidRight(updated.rightField)) updated.rightField = def.r;
|
||||
if (['DIFF_GT','DIFF_LT'].includes(newCondType)) updated.compareValue = updated.compareValue ?? 0;
|
||||
} else if (['SLOPE_UP','SLOPE_DOWN'].includes(newCondType)) {
|
||||
if (!isValid(updated.leftField)) updated.leftField = def.l;
|
||||
@@ -1417,7 +1423,9 @@ export const CondEditor: React.FC<CondEditorProps> = ({
|
||||
customNumber={getConditionThreshold(normalized, 'right', inheritedThresholdField, def)
|
||||
?? getChartReferenceThreshold(normalized, 'right', inheritedThresholdField, def)
|
||||
?? parseThresholdField(normalized.rightField)
|
||||
?? 0}
|
||||
?? defaultThresholdForRole(normalized.indicatorType, THRESHOLD_HL_MID, def.hlThresh)
|
||||
?? defaultThresholdForRole(normalized.indicatorType, THRESHOLD_HL_OVER, def.hlThresh)
|
||||
?? 50}
|
||||
numberPresets={getThresholdPresetOptions(normalized.indicatorType)}
|
||||
min={getThresholdBounds(normalized.indicatorType).min}
|
||||
max={getThresholdBounds(normalized.indicatorType).max}
|
||||
|
||||
Reference in New Issue
Block a user