배희수

Merge branch 'al_new' into 'developing'

fix error on rendering part



See merge request !9
......@@ -19,13 +19,21 @@ router.get('/', function(req, res, next) {
// 이전 10분간 데이터 찾기
sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')";
db.query(sql, function(err, rows, fields){
if (err) {
if(err)
{
console.log(err);
} else {
if (rows.length == 0) {
}
else
{
if (rows.length == 0)
{
empty = 1;
} else {
for (var i = rows.length - 1; i >= 0; i--){
}
else
{
for(var i = rows.length - 1; i >= 0; i--)
{
console.log('kk');
probArr.unshift(rows[i].prob);
time.unshift(rows[i].time);
ptArr.unshift(rows[i].temperature);
......@@ -37,6 +45,7 @@ router.get('/', function(req, res, next) {
break;
}
}
}
dataLen = probArr.length;
res.render('index', {
......@@ -49,8 +58,7 @@ router.get('/', function(req, res, next) {
dataLen
});
}
}
});
});
});
module.exports = router;
......