fix date bug

This commit is contained in:
Josh Harvey 2016-04-21 18:29:18 +03:00
parent fefeedb086
commit 1a93d6ae02
4 changed files with 17 additions and 4 deletions

1
.gitignore vendored
View file

@ -6,6 +6,7 @@ lib-cov
*.out *.out
*.pid *.pid
*.gz *.gz
*.pem
pids pids
logs logs

View file

@ -35,9 +35,12 @@ function checkPing (deviceEvents) {
var NETWORK_DOWN_TIME = 2 * 60 * 1000 var NETWORK_DOWN_TIME = 2 * 60 * 1000
if (!lastEvent) { if (!lastEvent) {
return [] return [{code: 'ping'}]
} }
console.log('DEBUG6')
console.log(lastEvent)
if (lastEvent.age > NETWORK_DOWN_TIME) { if (lastEvent.age > NETWORK_DOWN_TIME) {
return [{code: 'ping'}] return [{code: 'ping'}]
} }
@ -100,8 +103,11 @@ function checkStatus (cb) {
}) })
console.log('DEVICE: ' + deviceRow.fingerprint) console.log('DEVICE: ' + deviceRow.fingerprint)
alerts = R.concat(alerts, checkStuckScreen(deviceRow, deviceEvents)) alerts = R.concat(alerts, checkStuckScreen(deviceEvents))
alerts = R.concat(alerts, checkPing(deviceRow, deviceEvents)) alerts = R.concat(alerts, checkPing(deviceEvents))
console.log(deviceFingerprint)
console.log(alerts)
// TODO: Use promises to do this right // TODO: Use promises to do this right
}) })

View file

@ -368,6 +368,7 @@ exports.stateChange = function stateChange (session, rec, cb) {
} }
exports.recordPing = function recordPing (session, rec, cb) { exports.recordPing = function recordPing (session, rec, cb) {
console.log('DEBUG4')
var event = { var event = {
id: uuid.v4(), id: uuid.v4(),
fingerprint: session.fingerprint, fingerprint: session.fingerprint,

View file

@ -167,6 +167,7 @@ function dispenseAck (req, res) {
} }
function deviceEvent (req, res) { function deviceEvent (req, res) {
console.log('DEBUG5')
plugins.logEvent(session(req), req.body) plugins.logEvent(session(req), req.body)
res.json({err: null}) res.json({err: null})
} }
@ -271,7 +272,11 @@ function init (localConfig) {
} }
function session (req) { function session (req) {
return {fingerprint: getFingerprint(req), id: req.get('session-id')} return {
fingerprint: getFingerprint(req),
id: req.get('session-id'),
deviceTime: Date.parse(req.get('date'))
}
} }
function getFingerprint (req) { function getFingerprint (req) {