fix(plans): שם-תצוגה פשוט ("תכנית <מספר>") במשיכת mavat #295

Merged
chaim merged 1 commits from worktree-mavat-display-name-fix into main 2026-06-17 12:33:08 +00:00

View File

@@ -122,11 +122,17 @@ def _parse_sv4(sv4: dict, plan_number: str, source_url: str) -> dict:
pd = sv4.get("planDetails") if isinstance(sv4, dict) else None pd = sv4.get("planDetails") if isinstance(sv4, dict) else None
pd = pd if isinstance(pd, dict) else {} pd = pd if isinstance(pd, dict) else {}
display_name = _s(pd.get("E_NAME")) number = _s(pd.get("NUMB")) or plan_number
# display_name is the clean citation surface form — "תכנית <number>". mavat's
# E_NAME is a long descriptive title (the plan's substance), which belongs in
# purpose, NOT in the name block-ט cites. Keep E_NAME only as a purpose
# fallback so its content isn't lost when GOALS is empty.
e_name = _s(pd.get("E_NAME"))
display_name = f"תכנית {number}" if number else e_name
auth = _s(pd.get("AUTH")) auth = _s(pd.get("AUTH"))
subtype = _s(pd.get("ENTITY_SUBTYPE")) subtype = _s(pd.get("ENTITY_SUBTYPE"))
plan_type = f"{auth} ({subtype})" if auth and subtype else (auth or subtype) plan_type = f"{auth} ({subtype})" if auth and subtype else (auth or subtype)
purpose = _s(pd.get("GOALS")) purpose = _s(pd.get("GOALS")) or e_name
gazette_date, yalkut_number, yalkut_page = "", "", "" gazette_date, yalkut_number, yalkut_page = "", "", ""
rows = sv4.get("rsInternet") if isinstance(sv4, dict) else None rows = sv4.get("rsInternet") if isinstance(sv4, dict) else None
@@ -160,7 +166,7 @@ def _parse_sv4(sv4: dict, plan_number: str, source_url: str) -> dict:
break break
return { return {
"plan_number": _s(pd.get("NUMB")) or plan_number, "plan_number": number,
"display_name": display_name, "display_name": display_name,
"plan_type": plan_type, "plan_type": plan_type,
"purpose": purpose, "purpose": purpose,