fsb_backbone/server/selectionPriceChange.js
Martin Donnelly e1d9657e87 init
2021-03-12 07:55:43 +00:00

25 lines
604 B
JavaScript

module.exports = (data, socket) => {
const selections = [];
data.category.forEach(category => {
category.subcat.forEach(subcat => {
subcat.event.forEach(event => {
event.selection.forEach(selection => {
selections.push({
'newPrice': Math.floor(Math.random() * 9) + 1,
// id : selection.price
'id' : selection.id
});
});
});
});
});
selections.forEach(selection =>
setTimeout(() => {
socket.emit('selectionPriceUpdate', selection);
}, 1000 * (Math.floor(Math.random() * 15) + 1))
);
};