mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2025-01-20 17:11:30 +00:00
Fixed not calling ExperimentMark.customInit
This commit is contained in:
parent
b368453ffb
commit
2ac895e047
4 changed files with 14 additions and 7 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,4 +1,6 @@
|
|||
__pycache__
|
||||
*.pyc
|
||||
.vscode
|
||||
advLab.db
|
||||
server_setup.md
|
||||
server_setup.md
|
||||
db_backups
|
|
@ -587,7 +587,9 @@ class GroupExperimentView(SecureAdminModelView):
|
|||
[form.appointment1_assistant.data, form.appointment2_assistant.data],
|
||||
):
|
||||
if date:
|
||||
appointment = Appointment.customInit(date, special, assistant, model)
|
||||
appointment = Appointment.customInit(
|
||||
date=date, special=special, group_experiment=model, assistant=assistant
|
||||
)
|
||||
|
||||
self.session.add(appointment)
|
||||
|
||||
|
@ -639,7 +641,10 @@ class AppointmentView(SecureAdminModelView):
|
|||
|
||||
def customCreateModel(self, form):
|
||||
return Appointment.customInit(
|
||||
form.date.data, form.special.data, form.assistant.data, form.group_experiment.data
|
||||
date=form.date.data,
|
||||
special=form.special.data,
|
||||
group_experiment=form.group_experiment.data,
|
||||
assistant=form.assistant.data,
|
||||
)
|
||||
|
||||
def update_model(self, form, model):
|
||||
|
|
|
@ -218,7 +218,7 @@ class GroupExperiment(db.Model):
|
|||
groupExperiment = GroupExperiment(semester_experiment=semester_experiment, group=group)
|
||||
|
||||
for partStudent in group.part_students:
|
||||
db.session.add(ExperimentMark(part_student=partStudent, group_experiment=groupExperiment))
|
||||
db.session.add(ExperimentMark.customInit(part_student=partStudent, group_experiment=groupExperiment))
|
||||
|
||||
return groupExperiment
|
||||
|
||||
|
@ -359,7 +359,7 @@ class Appointment(db.Model):
|
|||
|
||||
return assistant
|
||||
|
||||
def customInit(date, special, assistant, group_experiment):
|
||||
def customInit(date, special, group_experiment, assistant):
|
||||
assistant = Appointment.checkAndGetAssistant(assistant, group_experiment)
|
||||
|
||||
return Appointment(
|
||||
|
|
|
@ -140,8 +140,8 @@ with app.app_context():
|
|||
db.session.add(as1)
|
||||
db.session.add(as2)
|
||||
|
||||
ap1 = Appointment.customInit(date=date(2021, 3, 21), special=True, assistant=as1, group_experiment=gx1)
|
||||
ap2 = Appointment.customInit(date=date(2021, 3, 22), special=True, assistant=as2, group_experiment=gx2)
|
||||
ap1 = Appointment.customInit(date=date(2021, 3, 21), special=True, group_experiment=gx1, assistant=as1)
|
||||
ap2 = Appointment.customInit(date=date(2021, 3, 22), special=True, group_experiment=gx2, assistant=as2)
|
||||
|
||||
db.session.add(ap1)
|
||||
db.session.add(ap2)
|
||||
|
|
Loading…
Add table
Reference in a new issue