mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Adjust GroupExperiment view
This commit is contained in:
parent
1142cd99b5
commit
c0bcdc4da5
1 changed files with 27 additions and 1 deletions
|
@ -50,14 +50,35 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
|
|||
column_list = [
|
||||
"semester_experiment.experiment",
|
||||
"group.number",
|
||||
"group.part_students",
|
||||
"appointments",
|
||||
# TODO: "final_experiment_marks_set",
|
||||
"note",
|
||||
]
|
||||
column_labels = {
|
||||
"semester_experiment.experiment": "Experiment",
|
||||
"group.number": "Group number",
|
||||
"group.part_students": "Students",
|
||||
}
|
||||
|
||||
def part_students_formatter(view, context, model, name):
|
||||
part_students = deep_getattr(model, name)
|
||||
if part_students is not None:
|
||||
return ", ".join([str(part_student.student) for part_student in part_students])
|
||||
|
||||
return attr
|
||||
|
||||
def appointments_formatter(view, context, model, name):
|
||||
appointments = deep_getattr(model, name)
|
||||
if appointments is not None:
|
||||
return ", ".join([str(appointment.date) for appointment in appointments])
|
||||
|
||||
return attr
|
||||
|
||||
column_formatters = {
|
||||
"semester_experiment.experiment": str_formatter,
|
||||
"group.part_students": part_students_formatter,
|
||||
"appointments": appointments_formatter,
|
||||
}
|
||||
|
||||
def query_modifier(self, query):
|
||||
|
@ -121,6 +142,8 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
|
|||
|
||||
db.session.rollback()
|
||||
|
||||
final_experiment_marks = [experiment_mark.final_experiment_mark for experiment_mark in experiment_marks]
|
||||
|
||||
return self.render(
|
||||
"assistant_group_experiment_form.html",
|
||||
form=form,
|
||||
|
@ -128,7 +151,10 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
|
|||
group_number=group_experiment.group.number,
|
||||
appointment_fields=appointment_fields,
|
||||
experiment_mark_zip=zip(
|
||||
experiment_mark_students, oral_experiment_mark_fields, protocol_experiment_mark_fields
|
||||
experiment_mark_students,
|
||||
oral_experiment_mark_fields,
|
||||
protocol_experiment_mark_fields,
|
||||
final_experiment_marks,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue