Toggle navigation
Toggle navigation
This project
Loading...
Sign in
배희수
/
2018_2_project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
배희수
2018-12-09 22:34:43 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
58349bda65e39fa2f0e7db1b7177ec591cc99c75
58349bda
1 parent
976b4672
렌더링 파트 오류 수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
routes/index.js
routes/index.js
View file @
58349bd
...
...
@@ -17,7 +17,7 @@ router.get('/', function(req, res, next) {
var
dataLen
=
0
;
// 데이터 개수
var
empty
=
0
;
// 초기값 유뮤, 0 : 자료 있음, 1 : 자료 없음
var
sql
=
""
;
// 쿼리
var
index
;
var
index
=
0
;
// 이전 10분간 데이터 찾기
sql
=
"SELECT * FROM weatherInfo WHERE time >= DATE_FORMAT(DATE_ADD(now(), INTERVAL -10 MINUTE), '%Y-%m-%d %H:%i:%s')"
;
...
...
@@ -28,16 +28,16 @@ router.get('/', function(req, res, next) {
if
(
rows
.
length
==
0
)
{
empty
=
1
;
}
else
{
dataLen
=
rows
.
length
;
for
(
index
=
0
;
index
<
rows
.
length
;
index
++
){
var
temp
=
rows
[
index
].
time
.
getMinutesBetween
(
newDate
);
for
(
var
i
=
rows
.
length
-
1
;
i
>=
0
;
i
--
){
var
temp
=
rows
[
i
].
time
.
getMinutesBetween
(
newDate
);
if
(
temp
==
index
){
probArr
.
push
(
rows
[
index
].
prob
);
time
.
push
(
rows
[
index
].
time
);
ptArr
.
push
(
rows
[
index
].
temperature
);
wsArr
.
push
(
rows
[
index
].
wind
);
rainArr
.
push
(
rows
[
index
].
rain
);
probArr
.
unshift
(
rows
[
i
].
prob
);
time
.
unshift
(
rows
[
i
].
time
);
ptArr
.
unshift
(
rows
[
i
].
temperature
);
wsArr
.
unshift
(
rows
[
i
].
wind
);
rainArr
.
unshift
(
rows
[
i
].
rain
);
index
=
index
+
1
;
}
else
{
empty
=
1
;
...
...
@@ -49,6 +49,7 @@ router.get('/', function(req, res, next) {
empty
=
0
;
}
dataLen
=
probArr
.
length
;
res
.
render
(
'index'
,
{
empty
,
time
,
...
...
Please
register
or
login
to post a comment