add boundaries to model and view
This commit is contained in:
parent
f2cad65626
commit
efacfe76ec
BIN
fgs/.model.py.swo
Normal file
BIN
fgs/.model.py.swo
Normal file
Binary file not shown.
25
fgs/model.py
25
fgs/model.py
|
@ -33,6 +33,31 @@ class StimulusActivation(db.Model):
|
||||||
voltage_level = db.Column(db.Integer)
|
voltage_level = db.Column(db.Integer)
|
||||||
datetime = db.Column(db.DateTime)
|
datetime = db.Column(db.DateTime)
|
||||||
|
|
||||||
|
|
||||||
|
class BoundingBox(db.Model):
|
||||||
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
collar_id = db.Column(db.Integer, db.ForeignKey('collar.id'))
|
||||||
|
coord0x = db.Column(db.Float(precision=10))
|
||||||
|
coord0y = db.Column(db.Float(precision=10))
|
||||||
|
coord1x = db.Column(db.Float(precision=10))
|
||||||
|
coord1y = db.Column(db.Float(precision=10))
|
||||||
|
coord2x = db.Column(db.Float(precision=10))
|
||||||
|
coord2y = db.Column(db.Float(precision=10))
|
||||||
|
coord3x = db.Column(db.Float(precision=10))
|
||||||
|
coord3y = db.Column(db.Float(precision=10))
|
||||||
|
coord4x = db.Column(db.Float(precision=10))
|
||||||
|
coord4y = db.Column(db.Float(precision=10))
|
||||||
|
coord5x = db.Column(db.Float(precision=10))
|
||||||
|
coord5y = db.Column(db.Float(precision=10))
|
||||||
|
coord6x = db.Column(db.Float(precision=10))
|
||||||
|
coord6y = db.Column(db.Float(precision=10))
|
||||||
|
coord7x = db.Column(db.Float(precision=10))
|
||||||
|
coord7y = db.Column(db.Float(precision=10))
|
||||||
|
coord8x = db.Column(db.Float(precision=10))
|
||||||
|
coord8y = db.Column(db.Float(precision=10))
|
||||||
|
coord9x = db.Column(db.Float(precision=10))
|
||||||
|
coord9y = db.Column(db.Float(precision=10))
|
||||||
|
|
||||||
class User(db.Model):
|
class User(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
username = db.Column(db.String)
|
username = db.Column(db.String)
|
||||||
|
|
|
@ -88,4 +88,8 @@ def collar_detail(id):
|
||||||
order_by(StimulusActivation.datetime.desc())
|
order_by(StimulusActivation.datetime.desc())
|
||||||
n_stimulus = stimulus_points.count()
|
n_stimulus = stimulus_points.count()
|
||||||
|
|
||||||
return jsonify({'id': collar.id, 'name': collar.name, 'stimilus': n_stimulus })
|
boundary = BoundingBox.query.filter_by(collar_id=collar.id).\
|
||||||
|
order_by(DataPoint.datetime.desc()).\
|
||||||
|
first()
|
||||||
|
|
||||||
|
return jsonify({'id': collar.id, 'name': collar.name, 'stimilus': n_stimulus, 'boundary': boundary })
|
||||||
|
|
Loading…
Reference in New Issue
Block a user