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

32 lines
746 B
JavaScript

const ramdonBoolean = () => Math.random() >= 0.5;
module.exports = (data, socket) => {
console.log(data)
};
module.exports = (data, socket) => {
const selections = [];
data.category.forEach(category => {
category.subcat.forEach(subcat => {
subcat.event.forEach(event => {
event.selection.forEach(selection => {
const { id, price } = selection;
selections.push({
newPrice: Math.floor(Math.random() * 9) + 1,
price,
id
});
});
});
});
});
selections.forEach(selection => socket.emit('price-update', selection));
};