1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Parse mark selection

This commit is contained in:
Mo 2022-06-27 00:20:30 +02:00
parent eb09b793c6
commit 89a0d295fe

View file

@ -20,6 +20,7 @@ from .model_dependent_funs import (
generate_new_password_field,
initActiveSemesterMenuLinks,
mark_field,
parse_selection_mark_field,
user_info_fields,
)
from .model_independent_funs import randomPassword, reportBadAttempt
@ -101,13 +102,25 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
]
if form.validate_on_submit():
try:
for ind, appointment in enumerate(appointments):
appointment.date = appointment_fields[ind].data
for ind, experiment_mark in enumerate(experiment_marks):
experiment_mark.oral_mark = parse_selection_mark_field(oral_experiment_mark_fields[ind])
experiment_mark.protocol_mark = parse_selection_mark_field(protocol_experiment_mark_fields[ind])
group_experiment.note = form.note.data
db.session.commit()
red = url_for("index") + "assistant/group_experiment"
return redirect(red)
except Exception as ex:
flash(str(ex), "error")
db.session.rollback()
return self.render(
"assistant_group_experiment_form.html",
form=form,