Commit 08c1a192 authored by Nelso Jost's avatar Nelso Jost

FIX: better usage

parent c6a0633b
......@@ -33,8 +33,6 @@ def api_post_rawsensordata(board_id):
if type(r) is str:
r = json.loads(request.json)
print(r)
if not 'user_hash' in r or r['user_hash'] != board.user.password_hash:
return jsonify({'error': 'Missing or invalid JSON "user_hash" '
'attribute for board of ID {}.'.format(board_id)})
......@@ -75,4 +73,5 @@ def api_post_rawsensordata(board_id):
db.session.commit()
return jsonify({'success': 'All data was sucessfully saved on the board.'})
return jsonify({'success': '{} new points were saved on the board.'
.format(len(r['data']))})
......@@ -155,6 +155,12 @@ class Board(db.Model, DBUtils):
sensor.rawdata.delete()
board.sensors.delete()
db.session.delete(board)
db.session.commit()
def clean_data(self):
for sensor in self.sensors.all():
sensor.rawdata.delete()
db.session.commit()
def send_to_form(self, form):
for field in self.__fields__:
......
Markdown is supported
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