fix(est): block missing quantity markers
This commit is contained in:
@@ -160,3 +160,24 @@ def test_target_row_ids_support_blank_and_duplicate_codes_for_both_modes():
|
||||
assert result["manual"] == [1, 7, 4]
|
||||
assert result["sheet"] == [[3, 4], [2, 7], [1, 5]]
|
||||
assert result["error"]
|
||||
|
||||
|
||||
def test_missing_or_extra_result_markers_block_quantity_application():
|
||||
result = run(
|
||||
"math",
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();p.tables.EstMainDat=[{PkID:1,Code:'X',GN:1}];
|
||||
p.quantitySheets=[{Code:'Q',options:{},rows:[{LineData:'2*3 = \\x120\\x12',markers:['r1']}],
|
||||
items:[{Code:'r1',GN:9,TargetKey:'id:1'}]}];
|
||||
const sheet=p.quantitySheets[0],valid=EstQuantity.calculate(sheet);
|
||||
const bad=[];for(const line of ['2*3 = 0','2*3 = \\x120\\x12 + \\x120\\x12']){
|
||||
sheet.rows[0].LineData=line;let blocked=false;
|
||||
try{EstQuantity.applyTotals(p,EstQuantity.totals(p,'Q'))}catch{blocked=true}
|
||||
bad.push({blocked,errors:EstQuantity.calculate(sheet).errors,quantity:p.tables.EstMainDat[0].GN});
|
||||
}
|
||||
return {valid,bad};
|
||||
})()""",
|
||||
)
|
||||
assert result["valid"]["errors"] == []
|
||||
assert result["valid"]["items"][0]["GN"] == 6
|
||||
assert all(row["blocked"] and row["errors"] and row["quantity"] == 1 for row in result["bad"])
|
||||
|
||||
Reference in New Issue
Block a user