|
|
@ -16,14 +16,16 @@ function update(){ |
|
|
|
item=line.split(" ") |
|
|
|
item=line.split(" ") |
|
|
|
itemID=item[1] |
|
|
|
itemID=item[1] |
|
|
|
itemAmt=item[0] |
|
|
|
itemAmt=item[0] |
|
|
|
itemHQ=item[2] |
|
|
|
hq=(item[2]!==undefined)?item[2].replace("\r",""):"" |
|
|
|
//console.log(itemID+" x"+itemAmt+" "+(itemHQ?"":"HQ"))
|
|
|
|
itemHQ=hq==="0"?false:true |
|
|
|
|
|
|
|
//console.log(itemID+" x"+itemAmt+" "+(itemHQ))
|
|
|
|
if(firstLoad){ |
|
|
|
if(firstLoad){ |
|
|
|
finalData=[{"id":itemID,"amt":itemAmt,"hq":Boolean(itemHQ)},...finalData] |
|
|
|
finalData=[...finalData,{"id":Number(itemID),"amt":Number(itemAmt),"hq":itemHQ}] |
|
|
|
}else |
|
|
|
}else |
|
|
|
if (finalData[i]!==undefined){ |
|
|
|
if (finalData[i]!==undefined&&(Number.isInteger(finalData[i].id)^Number.isInteger(itemID))){ |
|
|
|
if (finalData[i].id!==itemID||finalData[i].amt!==itemAmt||finalData[i].hq!==Boolean(itemHQ)){ |
|
|
|
if (finalData[i].id!=Number(itemID)||finalData[i].amt!==Number(itemAmt)||finalData[i].hq!==Boolean(itemHQ)){ |
|
|
|
finalData[i]={"id":itemID,"amt":itemAmt,"hq":Boolean(itemHQ)} |
|
|
|
console.log(JSON.stringify(finalData[i])+" !== "+JSON.stringify({"id":Number(itemID),"amt":Number(itemAmt),"hq":Boolean(itemHQ)})) |
|
|
|
|
|
|
|
finalData[i]={"id":Number(itemID),"amt":Number(itemAmt),"hq":Boolean(itemHQ)} |
|
|
|
changed=true; |
|
|
|
changed=true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|