test(chart): derive the Sun's expected Shadbala percent from total_rupas, not the 2-dp display value (BUG-1584)
backend-quality-gate #6711 on 43ccf3ad: 1 of 5672 frontend tests failed.
mapShadbala computes percent from the engine's total_rupas; the test rebuilt it
from the rounded display value. After #166 the Sun is 8.1836 Rupa: 8.18 / 6.5
-> 125.8, 8.1836 / 6.5 -> 125.9. Before, both rounded to 126.3. Code unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
@@ -21658,6 +21658,7 @@
|
||||
- 根因:分值抄自 Raman《Graha and Bhava Balas》,没有标口径。
|
||||
- 修复:默认改为 BPHS 45 / 30 / 20 / 15 / 10 / 4 / 2(`SAPTAVARGAJA_CONVENTION`),复合友敌取 D1(第 20 条,原实现已如此,测试锁住)。改动前的整套 Sthana / Drik 逐字保留为具名对照口径 `variant="raman_gbb"`,Raman 例 13、例 55 和 PyJHora 存档值在该口径下仍逐项吻合。
|
||||
- 验证:`test_astrologer_rulings_166.py::test_q16_saptavargaja_uses_bphs_values`;`test_shadbala_raman_gbb_standard_horoscope.py`、`test_shadbala_precise_context.py` 改为显式 `raman_gbb`。
|
||||
- 推送后补记(2026-11-04):staging `43ccf3ad` 的 backend-quality-gate #6711 前端 1 / 5672 失败:`chart-board-20261027.test.tsx` 用两位小数显示值 8.18 推太阳百分比(125.8),代码用原值 8.1836(125.9);旧数据两者恰好同为 126.3。测试改为用 `total_rupas` 原值。本机 `npm test` 因 docker / rsync / Postgres 缺失整体 exit 1,把这一条混在环境失败里漏看了;以后本机前端全量要按「改前改后失败清单」对比,不能只看 exit code。
|
||||
- 冻结身份:见 BUG-1583。
|
||||
- 防复发:同一函数多种口径用具名 variant,不混写。
|
||||
- 关联记录:BUG-1583、#166。
|
||||
|
||||
@@ -88,7 +88,9 @@ test("shadbala rows keep the engine totals and minimum, and read 达标 / 未达
|
||||
assert.equal(rows.length, 7);
|
||||
const sun = rows.find((row) => row.name === "Sun")!;
|
||||
assert.equal(sun.required, 6.5);
|
||||
assert.equal(sun.percent, Math.round((sun.rupas / 6.5) * 1000) / 10);
|
||||
// 原值: 用两位小数显示值 sun.rupas 推百分比;新值: 用引擎原值 total_rupas 推
|
||||
// 原因: #166(BUG-1584)后太阳 8.1836 Rupa,8.18 / 6.5 = 125.8 而 8.1836 / 6.5 = 125.9;mapShadbala 本来就用原值算
|
||||
assert.equal(sun.percent, Math.round((insight.chart_modules_shadbala.planets.Sun.total_rupas / 6.5) * 1000) / 10);
|
||||
assert.ok(sun.parts, "the six components come from modules.shadbala");
|
||||
const mercury = rows.find((row) => row.name === "Mercury")!;
|
||||
assert.equal(shadbalaStatus(mercury), "unmet", "6.94 of 7.0 rupas is 99 %");
|
||||
|
||||
Reference in New Issue
Block a user