feat: review entry reason picker uses dropdown instead of prompt
Add modal select for trade record review, expand options to two-level labels (反转/启动A), and accept legacy short labels on save. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1121,15 +1121,16 @@ STATS_SEGMENT_DEFS = (
|
||||
("key_trigger", "关键位触价开仓", {"segment": "key_trigger"}),
|
||||
)
|
||||
def normalize_entry_reason(raw, custom_text=None):
|
||||
v = str(raw or "").strip()
|
||||
return v if v in ENTRY_REASON_OPTIONS else ""
|
||||
from lib.trade.entry_model_lib import normalize_review_entry_reason
|
||||
|
||||
return normalize_review_entry_reason(raw, ENTRY_REASON_OPTIONS)
|
||||
|
||||
|
||||
def entry_reason_valid_for_storage(s):
|
||||
t = str(s or "").strip()
|
||||
if not t:
|
||||
return True
|
||||
return t in ENTRY_REASON_OPTIONS
|
||||
return bool(normalize_entry_reason(t))
|
||||
|
||||
|
||||
def normalize_early_exit_trigger(raw):
|
||||
@@ -9415,7 +9416,7 @@ def api_trade_record_review_update():
|
||||
s = str(payload.get("reviewed_entry_reason") or "").strip()
|
||||
if s and not entry_reason_valid_for_storage(s):
|
||||
return jsonify({"ok": False, "msg": "开仓类型须为下拉选项之一或留空"}), 400
|
||||
reviewed_entry_reason_update = s or None
|
||||
reviewed_entry_reason_update = normalize_entry_reason(s) or None
|
||||
|
||||
conn = get_db()
|
||||
row = conn.execute("SELECT risk_amount, symbol FROM trade_records WHERE id=?", (rec_id,)).fetchone()
|
||||
|
||||
Reference in New Issue
Block a user