diff --git a/lib/machine-loader.js b/lib/machine-loader.js index 0da73a82..c2729f83 100644 --- a/lib/machine-loader.js +++ b/lib/machine-loader.js @@ -51,16 +51,16 @@ const getStatus = (ping, stuck) => { function addName (pings, events, config) { return machine => { const cashOutConfig = configManager.getCashOut(machine.deviceId, config) - + const cashOut = !!cashOutConfig.active - + const statuses = [ getStatus( _.first(pings[machine.deviceId]), _.first(checkStuckScreen(events, machine.name)) - ) - ] - + ) + ] + return _.assign(machine, { cashOut, statuses }) } } @@ -132,9 +132,9 @@ function getMachine (machineId, config) { })) return Promise.all([queryMachine, dbm.machineEvents(), config]) - .then(([machine, events, config]) => { - const pings = checkPings([machine]) - + .then(([machine, events, config]) => { + const pings = checkPings([machine]) + return [machine].map(addName(pings, events, config))[0] }) }