This commit is contained in:
Thomas Forgione 2024-08-23 15:18:26 +02:00
parent 84b5703f64
commit be9d8128d6
1 changed files with 15 additions and 0 deletions

View File

@ -41,6 +41,9 @@ def calibrate():
@blueprint.route('/scan')
def scan():
"""
Starts a scan for calibration.
"""
conn = db.get()
if 'calibration_id' not in session:
@ -66,6 +69,9 @@ def scan():
@blueprint.route('/compute')
def compute():
"""
Compute the calibration from the scan.
"""
conn = db.get()
id = session['calibration_id']
calib = db.Calibration.get_from_id(id, conn)
@ -84,6 +90,9 @@ def compute():
@blueprint.route('/cancel')
def cancel():
"""
Cancels a calibration.
"""
conn = db.get()
calibration = db.Calibration.get_from_id(session['calibration_id'], conn)
calibration.state = db.CalibrationState.HasData
@ -94,6 +103,9 @@ def cancel():
@blueprint.route('/validate')
def validate():
"""
Validates a calibration.
"""
conn = db.get()
calib = utils.get_calibration(conn)
if calib is None:
@ -107,6 +119,9 @@ def validate():
@blueprint.route('/use-last')
def use_last():
"""
Sets the current calibration to the last one that was validated.
"""
conn = db.get()
calib = db.Calibration.get_last(conn)
session['calibration_id'] = calib.id