Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
fa1ce97e
Commit
fa1ce97e
authored
May 08, 2020
by
Vladislav Rykov
Browse files
dev data table + graph optimizations + preset fixes
parent
5b12e9a8
Changes
22
Hide whitespace changes
Inline
Side-by-side
app/app/views.py
View file @
fa1ce97e
...
...
@@ -17,7 +17,8 @@ import os
MAX_PG
=
5
MAX_PG_ENTRIES_USERS
=
10
MAX_PG_ENTRIES_DATA
=
30
MAX_PG_ENTRIES_DATA
=
10
MAX_PG_ENTRIES_GRAPH_HOURS
=
24
@
app
.
route
(
'/'
)
...
...
@@ -470,11 +471,10 @@ def settings():
return
redirect
(
request
.
url
)
@
app
.
route
(
'/dev-data/<var>/<dest>/<
cnt>/<
page>'
)
def
dev_data
(
var
,
dest
,
cnt
,
page
):
@
app
.
route
(
'/dev-data/<var>/<dest>/<page>'
)
def
dev_data
(
var
,
dest
,
page
):
if
dest
==
'graph'
:
# for graph <cnt> is in hours
last
=
data
.
get_last_range
(
session
[
'appkey'
],
session
[
'devid'
],
[
int
(
cnt
),
(
int
(
page
)
-
1
)
*
int
(
cnt
)])
last
=
data
.
get_last_hours
(
session
[
'appkey'
],
session
[
'devid'
],
MAX_PG_ENTRIES_GRAPH_HOURS
,
int
(
page
))
arr
=
'[["Time", "{}"],'
.
format
(
var
)
if
last
[
0
]:
for
d
in
last
[
1
]:
...
...
@@ -483,7 +483,18 @@ def dev_data(var, dest, cnt, page):
return
arr
elif
dest
==
'table'
:
# for table <cnt> is in items
pass
last
=
data
.
get_last_range
(
session
[
'appkey'
],
session
[
'devid'
],
[
MAX_PG_ENTRIES_DATA
,
(
int
(
page
)
-
1
)
*
MAX_PG_ENTRIES_DATA
])
t
=
""" <thead>
<th>Time</th>
<th>{}</th>
</thead>
<tbody>
"""
.
format
(
var
)
if
last
[
0
]:
for
d
in
last
[
1
]:
t
+=
'<tr><th>'
+
d
[
1
]
+
'</th><th>'
+
str
(
d
[
2
][
var
])
+
'</th></tr>'
t
+=
'</tbody>'
return
t
def
pend_delete_all_ack
():
...
...
app/config.py
View file @
fa1ce97e
...
...
@@ -4,7 +4,7 @@ class Config(object):
SECRET_KEY
=
b
'ksj^*(s90*Dklds;osdj'
DB_NAME
=
'
gateway
'
DB_NAME
=
'
iotserver
'
DB_USERNAME
=
'pi'
DB_PASSWORD
=
'dev'
DB_HOST
=
'localhost'
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment