fix(avastha): keep simultaneous conditions and use the PVR activity formula
Upstream e628118d, 7d545039, f75a6e77, and ac565836. Dignity follows the sign, Deeptadi keeps every condition that applies, and Shayanadi hours come from the previous Hindu sunrise. BUG-1389. Co-Authored-By: Grok (agent loop) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Grok (agent loop)
Cursor
parent
0bd254cf18
commit
83c97a8976
@@ -169,7 +169,14 @@ export function assembleReportFactTables(packet: unknown, language: ReportLangua
|
||||
} else if (id === "avasthas") {
|
||||
for (const [name, value] of entries(raw)) {
|
||||
if (!planet(name) || isBlocked(value)) continue;
|
||||
add(table, `${sourcePath}.${name}`, [L.planet(name, record(value).planet_cn), ...["Bala", "Jagrat", "Deeptadi", "Lajjitadi", "Shayanadi"].map(kind => L.text(at(value, `avasthas.${kind}.state`)))]);
|
||||
const cells = ["Bala", "Jagrat", "Deeptadi", "Lajjitadi", "Shayanadi"].map(kind => {
|
||||
const item = record(at(value, `avasthas.${kind}`));
|
||||
if (kind === "Deeptadi" && Array.isArray(item.applicable_states) && item.applicable_states.length) {
|
||||
return item.applicable_states.join("、");
|
||||
}
|
||||
return L.text(item.state);
|
||||
});
|
||||
add(table, `${sourcePath}.${name}`, [L.planet(name, record(value).planet_cn), ...cells]);
|
||||
}
|
||||
} else if (id === "special_points") {
|
||||
for (const kind of ["upagrahas.raw", "special_lagnas", "sensitive_points"]) {
|
||||
|
||||
@@ -140,7 +140,13 @@ test("density golden: state and position cells retain actual source values", ()
|
||||
const states = tables.find(t => t.id === "avasthas")!;
|
||||
for (const row of states.rows) {
|
||||
const raw = resolve(row.sourcePath);
|
||||
assert.deepEqual(row.cells.slice(1), ["Bala", "Jagrat", "Deeptadi", "Lajjitadi", "Shayanadi"].map(key => raw.avasthas[key].state));
|
||||
// 原值:五列都取 .state。新值:Deeptadi 有 applicable_states 时用「、」拼出并存条件,否则仍取 .state。原因:落陷与燃烧等同时成立的条件要留在表上,单标签只是兼容字段。
|
||||
assert.deepEqual(row.cells.slice(1), ["Bala", "Jagrat", "Deeptadi", "Lajjitadi", "Shayanadi"].map(key => {
|
||||
const item = raw.avasthas[key];
|
||||
return key === "Deeptadi" && Array.isArray(item.applicable_states) && item.applicable_states.length
|
||||
? item.applicable_states.join("、")
|
||||
: item.state;
|
||||
}));
|
||||
}
|
||||
for (const grid of [tables.find(t => t.id === "special_points")!, ...tables.find(t => t.id === "annual")!.subtables!]) {
|
||||
for (const row of grid.rows) {
|
||||
@@ -188,3 +194,16 @@ test("density blocked sources stay blocked and missing annual positions are not
|
||||
assert.match(tables.find(t => t.id === "annual")!.note, /年度上升:天蝎;年龄:26\.00/);
|
||||
assert.match(tables.find(t => t.id === "annual")!.note, /未返回年度行星位置,不补算/);
|
||||
});
|
||||
|
||||
test("avastha table shows simultaneous Deeptadi conditions in Chinese and English", () => {
|
||||
const altered = structuredClone(packet);
|
||||
const sun = altered.worksheets.advanced_systems.avasthas.Sun;
|
||||
sun.avasthas.Deeptadi.state = "Deepta";
|
||||
sun.avasthas.Deeptadi.applicable_states = ["Deepta", "Kopa"];
|
||||
for (const language of ["zh", "en"] as const) {
|
||||
const table = assembleReportFactTables(altered, language).find(item => item.id === "avasthas")!;
|
||||
assert.equal(table.columns[3], "Deeptadi");
|
||||
const row = table.rows.find(item => item.sourcePath.endsWith(".Sun"))!;
|
||||
assert.equal(row.cells[3], "Deepta、Kopa");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user