Commit ff1eb0bb authored by Vladislav Rykov's avatar Vladislav Rykov
Browse files

device no data fixed

parent 410fcbe1
......@@ -22,7 +22,7 @@ def index():
apps = ah.get_list(session['name'].encode('utf-8'))
session.pop('appkey', None)
print('apps: ', apps)
# print('apps: ', apps)
if apps[0]:
return render_template('index.html', apps=apps[1])
else:
......@@ -102,7 +102,7 @@ def app():
app = ah.get(session['appkey'])
devs = dh.get_list(app[1][1])
print('devs : ', devs)
# print('devs : ', devs)
return render_template('app.html', app=app[1], devs=devs[1])
else:
if request.form['appname'] == '':
......@@ -147,7 +147,7 @@ def new_dev():
dh = dd.DeviceDao()
dev_list = dh.get_list(session['appkey'])
print('dev list : ', dev_list)
#print('dev list : ', dev_list)
if not dev_list[0]:
return render_template('add-dev.html', feedback=dev_list[1])
......@@ -227,8 +227,10 @@ def dev_data():
#print(last)
#print(count)
return render_template('dev-data.html', data=last[1], total=count[1][0])
if count[1][0] > 0:
return render_template('dev-data.html', data=last[1], total=count[1][0])
else:
return render_template('dev-data.html')
@server.route('/data-csv')
def data_csv():
......
......@@ -6,6 +6,7 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
{% if data %}
<p>Last 5 messages:</p>
<table class="table">
......@@ -26,6 +27,9 @@
<p>Total: {{ total }} messages.</p>
<a href="/data-csv"><button type="submit" class="btn btn-primary">Download CSV</button></a>
{% else %}
<p>Device have not sent any data yet.</p>
{% endif %}
</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