fix(est): preserve fixed review amounts

This commit is contained in:
2026-11-07 08:45:49 +09:00
parent 3a10256e69
commit b3bd093d42
2 changed files with 16 additions and 1 deletions
@@ -80,3 +80,17 @@ def test_review_reset_one_row_keeps_other_inputs():
)
assert result["after"]["edits"] == {"row:2": {"GN": 3, "Reason": "second"}}
assert result["removed"]
def test_fixed_review_preserves_amount_for_reason_or_quantity_only():
result = run(
"math",
"""(()=>{
const p=EstNative.empty();p.tables.EstMainDat=[{PkID:1,Name:'fixed',GN:1,TC:100,CalcIndex:1}];
return [{Reason:'checked'},{GN:3},{GC:20}].map(edit=>{
p.contractReview={edits:{'row:1':edit}};
return EstReview.calculate(p).reviewed.tables.EstMainDat[0].TC;
});
})()""",
)
assert result == [100, 100, 20]
+2 -1
View File
@@ -61,7 +61,8 @@ const EstReview = (() => {
errors.push(`${row.Name || key}: 심사할 수 없는 항목 ${field}`);
else row[field] = edit[field];
}
if (fixed(row)) row.TC = EstMath.sum(row);
if (fixed(row) && EstMath.components.some((field) => Object.hasOwn(edit, field)))
row.TC = EstMath.sum(row);
});
for (const key of Object.keys(edits))
if (!seen.has(key)) errors.push(`심사 대상 내역 없음: ${key}`);