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:
parent
22ee6f7c54
commit
21981825a7
1 changed files with 9 additions and 0 deletions
|
@ -203,6 +203,7 @@ class GroupExperiment(db.Model):
|
||||||
# An experiment specified to a group
|
# An experiment specified to a group
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
note = db.Column(db.Text, nullable=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_id = db.Column(db.Integer, db.ForeignKey("semester_experiment.id"), nullable=False)
|
||||||
semester_experiment = db.relationship("SemesterExperiment", back_populates="group_experiments")
|
semester_experiment = db.relationship("SemesterExperiment", back_populates="group_experiments")
|
||||||
|
@ -238,6 +239,14 @@ class GroupExperiment(db.Model):
|
||||||
for partStudent in group.part_students:
|
for partStudent in group.part_students:
|
||||||
db.session.add(ExperimentMark(part_student=partStudent, group_experiment=self))
|
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):
|
class Experiment(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
|
Loading…
Reference in a new issue