|
|
@ -86,7 +86,7 @@ function update(){ |
|
|
|
async(err,data)=>{ |
|
|
|
async(err,data)=>{ |
|
|
|
var fileContents = data.toString().split("\n"); |
|
|
|
var fileContents = data.toString().split("\n"); |
|
|
|
if (fileContents.length>=387){ |
|
|
|
if (fileContents.length>=387){ |
|
|
|
for (i=0;i<fileContents.length;i++){ |
|
|
|
for (var i=0;i<fileContents.length;i++){ |
|
|
|
line=fileContents[i] |
|
|
|
line=fileContents[i] |
|
|
|
item=line.split(" ") |
|
|
|
item=line.split(" ") |
|
|
|
if (i==385){ |
|
|
|
if (i==385){ |
|
|
@ -100,7 +100,11 @@ function update(){ |
|
|
|
if (fileContents[387].split(" ")[0]!=0){ |
|
|
|
if (fileContents[387].split(" ")[0]!=0){ |
|
|
|
var tempLine=fileContents[387].split(" ")[0] |
|
|
|
var tempLine=fileContents[387].split(" ")[0] |
|
|
|
var tempLineAmt=fileContents[386].split(" ")[0] |
|
|
|
var tempLineAmt=fileContents[386].split(" ")[0] |
|
|
|
var itemObj={id:Number(tempLine)} |
|
|
|
var itemID=Number(tempLine); |
|
|
|
|
|
|
|
if (itemID>1000000){ |
|
|
|
|
|
|
|
itemID-=1000000 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var itemObj={id:itemID} |
|
|
|
await getItemData(itemObj) |
|
|
|
await getItemData(itemObj) |
|
|
|
var fileData=fs.readFileSync("goalamt.txt") |
|
|
|
var fileData=fs.readFileSync("goalamt.txt") |
|
|
|
if (fileData!=0){ |
|
|
|
if (fileData!=0){ |
|
|
@ -128,16 +132,18 @@ function update(){ |
|
|
|
itemHQ=hq==="0"?false:true |
|
|
|
itemHQ=hq==="0"?false:true |
|
|
|
newItem={"id":Number(itemID),"amt":Number(itemAmt),"hq":itemHQ} |
|
|
|
newItem={"id":Number(itemID),"amt":Number(itemAmt),"hq":itemHQ} |
|
|
|
//console.log(itemID+" x"+itemAmt+" "+(itemHQ))
|
|
|
|
//console.log(itemID+" x"+itemAmt+" "+(itemHQ))
|
|
|
|
if(firstLoad){ |
|
|
|
if (i<=384){ |
|
|
|
await getItemData(newItem) |
|
|
|
if(firstLoad){ |
|
|
|
finalData=[...finalData,newItem] |
|
|
|
|
|
|
|
}else |
|
|
|
|
|
|
|
if (finalData[i]!==undefined&&(Number.isInteger(finalData[i].id)^Number.isInteger(itemID))){ |
|
|
|
|
|
|
|
if (finalData[i].id!=Number(itemID)||finalData[i].amt!==Number(itemAmt)||finalData[i].hq!==Boolean(itemHQ)){ |
|
|
|
|
|
|
|
await getItemData(newItem) |
|
|
|
await getItemData(newItem) |
|
|
|
console.log(JSON.stringify(finalData[i])+" !== "+JSON.stringify(newItem)) |
|
|
|
finalData=[...finalData,newItem] |
|
|
|
finalData[i]=newItem |
|
|
|
}else |
|
|
|
changed=true; |
|
|
|
if (finalData[i]!==undefined&&(Number.isInteger(finalData[i].id)^Number.isInteger(itemID))){ |
|
|
|
|
|
|
|
if (finalData[i].id!=Number(itemID)||finalData[i].amt!==Number(itemAmt)||finalData[i].hq!==Boolean(itemHQ)){ |
|
|
|
|
|
|
|
await getItemData(newItem) |
|
|
|
|
|
|
|
console.log(JSON.stringify(finalData[i])+" !== "+JSON.stringify(newItem)) |
|
|
|
|
|
|
|
finalData[i]=newItem |
|
|
|
|
|
|
|
changed=true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|