Auto use last calibration mode
This commit is contained in:
parent
ed4a448016
commit
c7903ef4b5
11
app.py
11
app.py
|
|
@ -36,8 +36,17 @@ def inject_stage_and_region():
|
|||
return dict(calibration=get_calibration(conn), CalibrationState=db.CalibrationState)
|
||||
|
||||
|
||||
@app.before_request
|
||||
def manage_auto_use_last_calibration():
|
||||
if config.AUTO_USE_LAST_CALIBRATION and 'calibration_id' not in session:
|
||||
conn = db.get()
|
||||
last = db.Calibration.get_last(conn)
|
||||
if last is not None:
|
||||
session['calibration_id'] = last.id
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def hello_world():
|
||||
def index():
|
||||
conn = db.get()
|
||||
objects = db.Object.all(conn)
|
||||
return render_template('index.html', objects=objects)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ BACKUPS_DIR = 'data-backups'
|
|||
CALIBRATION_DIR = join(DATA_DIR, 'calibrations')
|
||||
OBJECT_DIR = join(DATA_DIR, 'objects')
|
||||
DATABASE_PATH = join(DATA_DIR, 'db.sqlite')
|
||||
SECRET_KEY = 'tobedefined'
|
||||
|
||||
AUTO_USE_LAST_CALIBRATION = False
|
||||
|
||||
LEDS_UUIDS = [
|
||||
'ac59350e-3787-46d2-88fa-743c1d34fe86',
|
||||
|
|
|
|||
Loading…
Reference in New Issue