fix(est): preserve fixed review amounts
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user