removed zero padding from os series
This commit is contained in:
7
order.js
7
order.js
@@ -9,8 +9,6 @@ export function sendVaultOrders( socket, chainId, vault ) {
|
|||||||
archivedOrders(chainId, vault),
|
archivedOrders(chainId, vault),
|
||||||
]).then(async (got)=>{
|
]).then(async (got)=>{
|
||||||
const [openIndexes, closedIndexes, recents] = got
|
const [openIndexes, closedIndexes, recents] = got
|
||||||
console.log('vault open orders', openIndexes)
|
|
||||||
console.log('vault closed orders', closedIndexes)
|
|
||||||
const statuses = {}
|
const statuses = {}
|
||||||
const indexes = [...JSON.parse(openIndexes), ...JSON.parse(closedIndexes)]
|
const indexes = [...JSON.parse(openIndexes), ...JSON.parse(closedIndexes)]
|
||||||
const proms = []
|
const proms = []
|
||||||
@@ -24,18 +22,17 @@ export function sendVaultOrders( socket, chainId, vault ) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('vault archived orders', recents)
|
|
||||||
for( let [orderIndex, status] of recents ) {
|
for( let [orderIndex, status] of recents ) {
|
||||||
if( !(orderIndex in statuses) ) {
|
if( !(orderIndex in statuses) ) {
|
||||||
// only write the database version if there's no open order in the memcache
|
// only write the database version if there's no open order in the memcache
|
||||||
const orderKey = `${vault}|${orderIndex.toString().padStart(5,'0')}`
|
const orderKey = `${vault}|${orderIndex}`
|
||||||
proms.push(fillOrderStatus(chainId, orderKey, status))
|
proms.push(fillOrderStatus(chainId, orderKey, status))
|
||||||
statuses[orderIndex] = status
|
statuses[orderIndex] = status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Promise.all(proms)
|
await Promise.all(proms)
|
||||||
const result = []
|
const result = []
|
||||||
for( const index of Object.keys(statuses).sort())
|
for(const index of Object.keys(statuses))
|
||||||
result.push([parseInt(index), statuses[index]])
|
result.push([parseInt(index), statuses[index]])
|
||||||
socket.emit('os', chainId, vault, result)
|
socket.emit('os', chainId, vault, result)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user