Timezone fix and query order
This commit is contained in:
@@ -3,7 +3,8 @@ var connection = mysql.createConnection({
|
||||
host : 'localhost',
|
||||
user : 'root',
|
||||
password : 'asdf1239',
|
||||
database : 'smarthome'
|
||||
database : 'smarthome',
|
||||
timezone : 'utc'
|
||||
});
|
||||
|
||||
connection.connect(function(err) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user