Merge branch 'al_new' into 'developing'
fix error on rendering part See merge request !9
Showing
1 changed file
with
15 additions
and
7 deletions
... | @@ -19,13 +19,21 @@ router.get('/', function(req, res, next) { | ... | @@ -19,13 +19,21 @@ router.get('/', function(req, res, next) { |
19 | // 이전 10분간 데이터 찾기 | 19 | // 이전 10분간 데이터 찾기 |
20 | sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')"; | 20 | sql = "SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -20 MINUTE), '%Y-%m-%d %H:%i:%s')"; |
21 | db.query(sql, function(err, rows, fields){ | 21 | db.query(sql, function(err, rows, fields){ |
22 | - if (err) { | 22 | + if(err) |
23 | + { | ||
23 | console.log(err); | 24 | console.log(err); |
24 | - } else { | 25 | + } |
25 | - if (rows.length == 0) { | 26 | + else |
27 | + { | ||
28 | + if (rows.length == 0) | ||
29 | + { | ||
26 | empty = 1; | 30 | empty = 1; |
27 | - } else { | 31 | + } |
28 | - for (var i = rows.length - 1; i >= 0; i--){ | 32 | + else |
33 | + { | ||
34 | + for(var i = rows.length - 1; i >= 0; i--) | ||
35 | + { | ||
36 | + console.log('kk'); | ||
29 | probArr.unshift(rows[i].prob); | 37 | probArr.unshift(rows[i].prob); |
30 | time.unshift(rows[i].time); | 38 | time.unshift(rows[i].time); |
31 | ptArr.unshift(rows[i].temperature); | 39 | ptArr.unshift(rows[i].temperature); |
... | @@ -37,6 +45,7 @@ router.get('/', function(req, res, next) { | ... | @@ -37,6 +45,7 @@ router.get('/', function(req, res, next) { |
37 | break; | 45 | break; |
38 | } | 46 | } |
39 | } | 47 | } |
48 | + } | ||
40 | 49 | ||
41 | dataLen = probArr.length; | 50 | dataLen = probArr.length; |
42 | res.render('index', { | 51 | res.render('index', { |
... | @@ -49,8 +58,7 @@ router.get('/', function(req, res, next) { | ... | @@ -49,8 +58,7 @@ router.get('/', function(req, res, next) { |
49 | dataLen | 58 | dataLen |
50 | }); | 59 | }); |
51 | } | 60 | } |
52 | - } | 61 | + }); |
53 | -}); | ||
54 | }); | 62 | }); |
55 | 63 | ||
56 | module.exports = router; | 64 | module.exports = router; | ... | ... |
-
Please register or login to post a comment