feat(est): exchange price adjustment inputs
This commit is contained in:
@@ -25,6 +25,60 @@ def export_workbook(project):
|
||||
return result.stdout
|
||||
|
||||
|
||||
def test_excel_escalation_fields_and_settings_roundtrip_validation():
|
||||
import openpyxl
|
||||
|
||||
workbook = openpyxl.load_workbook(
|
||||
io.BytesIO(
|
||||
export_workbook(
|
||||
{
|
||||
"tables": {
|
||||
"EstMainDat": [{"PkID": 1, "Code": "R", "AGU": 80}, {"LinkIndex": 54}]
|
||||
},
|
||||
"options": {"EscDesignTotal": 1200},
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
sheet = workbook["Escalation"]
|
||||
assert "AGU" not in [cell.value for cell in workbook["EstMainDat"][1]]
|
||||
assert list(next(sheet.values)) == [
|
||||
"RowKey",
|
||||
"ANU",
|
||||
"AGU",
|
||||
"AJU",
|
||||
"ASU",
|
||||
"EscPlanned",
|
||||
"EscActual",
|
||||
"EscProgress",
|
||||
"EscAuto",
|
||||
"EscManualQuantity",
|
||||
"EscConstruction",
|
||||
"EscPS",
|
||||
"EscBefore",
|
||||
]
|
||||
assert workbook["EscalationSettings"]["A2"].value == 1200
|
||||
result = run(
|
||||
"math",
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();p.options.SourceRefresh=false;
|
||||
p.tables.EstMainDat=[{PkID:1,Code:'R',GN:10,GU:100},{LinkIndex:54}];
|
||||
const before=JSON.stringify(p), sheets={Escalation:[{RowKey:'1',AGU:80,EscActual:3,EscAuto:false,EscManualQuantity:2}],EscalationSettings:[{EscDesignTotal:1200}]};
|
||||
const q=EstExchange.apply(p,sheets), output=EstEscalation.calculate(q);
|
||||
let bad=0;
|
||||
for(const rows of [[{RowKey:'missing'}],[{RowKey:'1'},{RowKey:'1'}],[{RowKey:'1',EscAuto:'false'}],[{RowKey:'1',AGU:'wrong'}]]) {
|
||||
try{EstExchange.apply(p,{Escalation:rows})}catch{bad++}
|
||||
}
|
||||
try{EstExchange.apply(p,{EscalationSettings:[{EscDesignTotal:-1}]})}catch{bad++}
|
||||
return {q,output,bad,same:before===JSON.stringify(p)};
|
||||
})()""",
|
||||
)
|
||||
assert result["same"] and result["bad"] == 5
|
||||
assert result["q"]["options"]["EscDesignTotal"] == 1200
|
||||
assert result["q"]["tables"]["EstMainDat"][0]["AGU"] == 80
|
||||
assert result["output"]["rows"][0]["EscExcluded"] == 2
|
||||
|
||||
|
||||
def test_excel_is_valid_office_zip_with_numeric_text_types_and_no_executable_formulas():
|
||||
data = export_workbook(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user