Files
Jyotisha/frontend/src/lib/rectification-varga-sentence.ts
T
Jesse_Chen 517df002b5 fix(rectification): narrate the credible range and stop scoring periods by length (BUG-569–570)
Choice copy was comparing the search window, so every answer said the range had not changed. Block-scan summed raw scores, so longer afternoon windows won before any evidence difference.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 10:03:28 +08:00

41 lines
1.6 KiB
TypeScript

import type { PublicRectificationMethod } from "./rectification-agentic/v9/public-receipt";
export const PUBLIC_RECTIFICATION_METHOD_LABELS: Readonly<Record<PublicRectificationMethod, string>> = {
"d1-rashi": "D1 本命盘",
"d2-hora": "D2 财帛分盘",
"d3-drekkana": "D3 兄弟分盘",
"d4-chaturthamsha": "D4 迁移分盘",
"d5-panchamsha": "D5 成就分盘",
"d7-saptamsha": "D7 子女分盘",
"d9-navamsa": "D9 婚姻分盘",
"d10-dashamsa": "D10 事业分盘",
"d11-labhamsha": "D11 收益分盘",
"d12-dwadashamsha": "D12 父母分盘",
"d24-chaturvimshamsha": "D24 教育分盘",
"d30-trimshamsha": "D30 健康压力分盘",
"vimshottari-dasha": "Vimshottari",
"narayana-dasha": "Narayana",
gochara: "Gochara",
ashtakavarga: "Ashtakavarga",
shadbala: "Shadbala",
"arudha-pada": "Arudha Pada",
"functional-benefic-malefic": "本命功能吉凶星",
};
export function publicRectificationMethodLabel(methodOrTrack: string): string | null {
const direct = PUBLIC_RECTIFICATION_METHOD_LABELS[methodOrTrack as PublicRectificationMethod];
if (direct) return direct;
return PUBLIC_RECTIFICATION_METHOD_LABELS[`${methodOrTrack}-dasha` as PublicRectificationMethod] ?? null;
}
export function vargaSentenceFromMethods(
methods: readonly string[] | null | undefined,
): string | null {
const labels = [...new Set((methods ?? []).flatMap((method) => {
const label = publicRectificationMethodLabel(method);
return label ? [label] : [];
}))];
if (labels.length === 0) return null;
return `本轮对照了${labels.join("、")}`;
}