diff --git a/mean-app/server/db.js b/mean-app/server/db.js index c741ebd..2098ac2 100644 --- a/mean-app/server/db.js +++ b/mean-app/server/db.js @@ -3,7 +3,8 @@ var connection = mysql.createConnection({ host : 'localhost', user : 'root', password : 'asdf1239', - database : 'smarthome' + database : 'smarthome', + timezone : 'utc' }); connection.connect(function(err) { diff --git a/mean-app/server/routes/webapi.js b/mean-app/server/routes/webapi.js index b4ef6bb..81a063b 100644 --- a/mean-app/server/routes/webapi.js +++ b/mean-app/server/routes/webapi.js @@ -32,7 +32,7 @@ router.get('/data/:device', function(req, res) { let devid = req.params.device; connection.query( - 'SELECT TOE1, TOE2, HOV, HT, time FROM measurement WHERE device = ? ORDER BY time DESC LIMIT 0,25', [devid], + 'SELECT s.* FROM ( SELECT TOE1, TOE2, HOV, HT, time FROM measurement WHERE device = ? ORDER BY time DESC LIMIT 0,25 ) s ORDER BY s.time ASC', [devid], function (error, results, fields) { if (error) throw error;