fix(est): apply selected quantity calculations
This commit is contained in:
@@ -102,3 +102,28 @@ def test_insert_and_move_quantity_rows_keeps_item_results_linked():
|
||||
assert result["linked"]["errors"] == []
|
||||
assert result["linked"]["items"][1]["GN"] == 6
|
||||
assert result["forward"]["errors"]
|
||||
|
||||
|
||||
def test_manual_and_selected_sheet_totals_validate_before_application():
|
||||
result = run(
|
||||
"math",
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();
|
||||
p.tables.EstMainDat=[{Code:'X',Level:0,GN:1,MulCode:{binary:'YWJj'}}];
|
||||
p.quantities=[{Code:'A',formula:'2',TargetCode:'X'},
|
||||
{Code:'B',formula:'[A]*3',TargetCode:'X'}];
|
||||
const manual=EstQuantity.totals(p,'manual');EstQuantity.applyTotals(p,manual);
|
||||
const a=structuredClone(p.tables.EstMainDat[0]);
|
||||
p.quantitySheets=[{Code:'Q',options:{},rows:[{LineData:'4+5 = \\x120\\x12',markers:['r1']}],
|
||||
items:[{Code:'r1',GN:0,TargetCode:'X'}]}];
|
||||
const sheet=EstQuantity.totals(p,'Q');EstQuantity.applyTotals(p,sheet);
|
||||
let invalid='';p.quantities.push({Code:'C',formula:'1',TargetCode:'missing'});
|
||||
try{EstQuantity.totals(p,'manual')}catch(e){invalid=e.message}
|
||||
return {a,b:p.tables.EstMainDat[0],invalid};
|
||||
})()""",
|
||||
)
|
||||
assert result["a"]["GN"] == 8
|
||||
assert result["a"]["MulCode"] == {"binary": "YWJj"}
|
||||
assert result["b"]["GN"] == 9
|
||||
assert result["b"]["MulCode"] == {"binary": "YWJj"}
|
||||
assert result["invalid"]
|
||||
|
||||
Reference in New Issue
Block a user