-
Notifications
You must be signed in to change notification settings - Fork 0
/
database_handler.py
27 lines (22 loc) · 945 Bytes
/
database_handler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from database import init_db
from database import db_session
from models import settings
from sqlalchemy.sql.expression import func
# Analysis modes
# noAn, simple, 2areaVert, 3areaVert, 2areaHor, 3areaHor
def debugDb():
#sets = settings('no','yes','simple','no', 'True', 'False', 'False', 300, 10)
#db_session.add(sets)
#db_session.commit()
print(str(getLastSetting()))
def getLastSettingIndex():
return db_session.query(func.max(settings.id)).scalar()
def getLastSetting():
setting = settings.query.filter(settings.id == getLastSettingIndex()).first()
return setting
def setNewSetting(displayTimestamp, displayBoundaries, analysisMode, useYOLO,
area1, area2, area3, sensitivity, maxTicks):
sets = settings(displayTimestamp, displayBoundaries, analysisMode, useYOLO,
area1, area2, area3, int(sensitivity), int(maxTicks))
db_session.add(sets)
db_session.commit()