1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00

Add experiment_marks_missing

This commit is contained in:
Mo 2022-06-28 00:57:59 +02:00
parent 22ee6f7c54
commit 21981825a7

View file

@ -203,6 +203,7 @@ class GroupExperiment(db.Model):
# An experiment specified to a group
id = db.Column(db.Integer, primary_key=True)
note = db.Column(db.Text, nullable=True)
experiment_marks_missing = db.Column(db.Boolean, default=False, nullable=False)
semester_experiment_id = db.Column(db.Integer, db.ForeignKey("semester_experiment.id"), nullable=False)
semester_experiment = db.relationship("SemesterExperiment", back_populates="group_experiments")
@ -238,6 +239,14 @@ class GroupExperiment(db.Model):
for partStudent in group.part_students:
db.session.add(ExperimentMark(part_student=partStudent, group_experiment=self))
def update_experiment_marks_missing(self):
for experiment_mark in self.experiment_marks:
if experiment_mark.final_part_mark is None:
self.experiment_marks_missing = False
return
self.experiment_marks_missing = True
class Experiment(db.Model):
id = db.Column(db.Integer, primary_key=True)