From dddb70ff6f44acf43ae6af5fe99b44fccfbe5cc8 Mon Sep 17 00:00:00 2001 From: potaser Date: Sun, 11 Oct 2026 12:19:18 +0800 Subject: [PATCH] fix(review): directory partition source shown as constant note Stop sending partition_source_url; respond with a fixed explanatory note instead. DB values untouched (dropped after SELECT). --- .../app/routers/journal_directory.py | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/review_service/app/routers/journal_directory.py b/review_service/app/routers/journal_directory.py index b92b60d..113ddcc 100644 --- a/review_service/app/routers/journal_directory.py +++ b/review_service/app/routers/journal_directory.py @@ -11,12 +11,14 @@ 读时归一化(拍板细节 1-3,均在 API 层做,不动脚本/DB 原值): 细节1 lang=zh → cas_partition 恒 null + cas_partition_note="不按中科院分区口径列示"; 细节2 jif_note 源文本映射(v4 值域已是用户可读文本,旧值映射保留兜底); - 细节3 缺值即矛盾清零:en 且 jif=null → jif_source_url=null; - cas_partition=null → partition_source_url=null。 + 细节3 缺值即矛盾清零:en 且 jif=null → jif_source_url=null。 (zh 的 IF 载体是 composite/comprehensive,其 jif_source_url 本恒 null。) - 决策2:响应不再下发"来源"文本字段(partition_source/jif_source/data_source_label - 已从 DirectoryItem 移除;jif_source_url/partition_source_url/data_source_url - 保留,供前端展开行链接)。新增 official_check_status / jcr_release_year。 + 决策2:响应不下发"来源"文本字段(partition_source/jif_source/data_source_label + 已移除);jif_source_url/data_source_url 保留供展开行链接。 + 决策4(来源展示优化):partition_source_url 不再下发——DB 原值分毫未动 + (仍 SELECT * 读出后被模型丢弃),响应改为常量字段 partition_source_note + 文案,前端以灰色说明文字替代原"分区来源"超链接。 + 新增 official_check_status / jcr_release_year。 """ from __future__ import annotations @@ -54,6 +56,10 @@ _JIF_NOTE_MAP = { "所用年度来源未检得": "本次汇编未查到,建议查阅最新 JCR", } _ZH_PART_NOTE = "不按中科院分区口径列示" +# 决策4:分区来源改为常量说明文案(不下发 partition_source_url;DB 原值不动) +_PARTITION_SOURCE_NOTE = ( + "2025 中科院官方表(2026 年起停更;官方入口 fenqubiao.com 需机构登录)" +) _NOTE_EN = ( "分区:2025年中科院公开表(多表比对,2026年起停止更新);" @@ -101,7 +107,7 @@ class DirectoryItem(BaseModel): official_check_status: str | None = None jcr_release_year: int | None = None jif_source_url: str | None = None - partition_source_url: str | None = None + partition_source_note: str = _PARTITION_SOURCE_NOTE # 决策4:常量,替代分区来源链接 data_source_url: str | None = None @@ -145,12 +151,10 @@ def _present(raw: dict[str, Any], lang: str) -> dict[str, Any]: d["cas_partition_note"] = _ZH_PART_NOTE # 细节3:缺值 → 来源链接清零(消除 null 值却挂来源链接的矛盾; - # "来源"文本字段已按决策2 移出响应,此处只清 *_url) + # 分区来源链接已按决策4 移出响应,改为常量 partition_source_note) if lang == "en": if d.get("jif") is None: d["jif_source_url"] = None - if d.get("cas_partition") is None: - d["partition_source_url"] = None return d