diff --git a/advlabdb/models.py b/advlabdb/models.py index be3a2e4..1697f9a 100644 --- a/advlabdb/models.py +++ b/advlabdb/models.py @@ -535,11 +535,12 @@ class ExperimentMark(db.Model): return ExperimentMark(part_student=part_student, group_experiment=group_experiment) def updateFinalExperimentMark(self): - semesterExperiment = self.group_experiment.semester_experiment - self.final_experiment_mark = roundHalfUpToInt( - semesterExperiment.oral_weighting * self.oral_mark - + semesterExperiment.protocol_weighting * self.protocol_mark - ) + if None not in (self.oral_mark, self.protocol_mark): + semesterExperiment = self.group_experiment.semester_experiment + self.final_experiment_mark = roundHalfUpToInt( + semesterExperiment.oral_weighting * self.oral_mark + + semesterExperiment.protocol_weighting * self.protocol_mark + ) def repr(self): return f"Mark {self.final_experiment_mark}; Exp {self.group_experiment.semester_experiment.repr()}"