Commit 4b2748f1 authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

data dump files cleaning + dev no data view fixed

parent 345294e8
rh,temp,
40.3,20.2,
41.3,22.2,
21.5,55.2,
71.5,33.2,
31.5,53.2,
21.5,13.2,
81.5,23.2,
11.5,93.2,
...@@ -8,6 +8,7 @@ import dao.device.device as dd ...@@ -8,6 +8,7 @@ import dao.device.device as dd
import dao.pend.pend as pend import dao.pend.pend as pend
import dao.data.data as data import dao.data.data as data
import binascii import binascii
import os
APP_KEY_LEN = 8 APP_KEY_LEN = 8
...@@ -102,6 +103,14 @@ def app(): ...@@ -102,6 +103,14 @@ def app():
app = ah.get(session['appkey']) app = ah.get(session['appkey'])
devs = dh.get_list(app[1][1]) devs = dh.get_list(app[1][1])
try:
filelist = [f for f in os.listdir(DATA_DOWNLOAD_DIR) if f.startswith(session['appkey'])]
print(filelist)
for f in filelist:
os.remove(DATA_DOWNLOAD_DIR+'/'+f)
except OSError:
pass
# print('devs : ', devs) # print('devs : ', devs)
return render_template('app.html', app=app[1], devs=devs[1]) return render_template('app.html', app=app[1], devs=devs[1])
else: else:
...@@ -240,7 +249,7 @@ def dev_data(): ...@@ -240,7 +249,7 @@ def dev_data():
if count[1][0] > 0: if count[1][0] > 0:
return render_template('dev-data.html', data=last[1], total=count[1][0], lastctr=last_ctr, devname=session['devname']) return render_template('dev-data.html', data=last[1], total=count[1][0], lastctr=last_ctr, devname=session['devname'])
else: else:
return render_template('dev-data.html') return render_template('dev-data.html', devname=session['devname'])
@server.route('/data-csv') @server.route('/data-csv')
def data_csv(): def data_csv():
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a> <a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a>
</center> </center>
{% else %} {% else %}
<h3>Device have not sent any data yet.</h3> <h3><center>Device have not sent any data yet.</center></h3>
{% endif %} {% endif %}
</div> </div>
</div> </div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment