feat: show entry type in trade records, remove journal custom entry reason
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1110,14 +1110,8 @@ STATS_SEGMENT_DEFS = (
|
||||
("key_false_breakout", "关键位假突破", {"segment": "key_false_breakout"}),
|
||||
("key_trigger", "关键位触价开仓", {"segment": "key_trigger"}),
|
||||
)
|
||||
ENTRY_REASON_OTHER = "__OTHER__"
|
||||
|
||||
|
||||
def normalize_entry_reason(raw, custom_text=None):
|
||||
v = str(raw or "").strip()
|
||||
if v == ENTRY_REASON_OTHER:
|
||||
c = str(custom_text or "").strip()
|
||||
return c[:2000] if c else ""
|
||||
return v if v in ENTRY_REASON_OPTIONS else ""
|
||||
|
||||
|
||||
@@ -6613,7 +6607,6 @@ def render_main_page(page="trade", embed_mode=None):
|
||||
trend_manual_count=trend_manual_entry_reason_count(TRADE_POLICY),
|
||||
)
|
||||
),
|
||||
entry_reason_other_value=ENTRY_REASON_OTHER,
|
||||
key_auto_order_enabled=KEY_AUTO_ORDER_ENABLED,
|
||||
journal_chart_tf_choices=JOURNAL_CHART_TF_CHOICES,
|
||||
journal_chart_default_tf1=JOURNAL_CHART_DEFAULT_TF1,
|
||||
@@ -8486,7 +8479,7 @@ def del_order(id):
|
||||
@login_required
|
||||
def add_journal():
|
||||
d = request.form
|
||||
entry_reason_norm = normalize_entry_reason(d.get("entry_reason"), d.get("entry_reason_custom"))
|
||||
entry_reason_norm = normalize_entry_reason(d.get("entry_reason"))
|
||||
if not entry_reason_norm:
|
||||
flash("请选择开仓类型")
|
||||
return _redirect_records()
|
||||
@@ -8866,7 +8859,7 @@ def api_trade_record_review_update():
|
||||
if "reviewed_entry_reason" in payload:
|
||||
s = str(payload.get("reviewed_entry_reason") or "").strip()
|
||||
if s and not normalize_entry_reason(s):
|
||||
return jsonify({"ok": False, "msg": "开仓类型须为五种固定枚举整句之一或留空"}), 400
|
||||
return jsonify({"ok": False, "msg": "开仓类型须为下拉选项之一或留空"}), 400
|
||||
reviewed_entry_reason_update = s or None
|
||||
|
||||
conn = get_db()
|
||||
|
||||
Reference in New Issue
Block a user