Timezone fix and query order

This commit is contained in:
2017-04-10 13:28:38 +02:00
parent 75f09a1240
commit 75f8242319
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -3,7 +3,8 @@ var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'asdf1239',
database : 'smarthome'
database : 'smarthome',
timezone : 'utc'
});
connection.connect(function(err) {
+1 -1
View File
@@ -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;