Commit 3f80b31f authored by LammLukas's avatar LammLukas

Added bonus to evaluation

parent fb7c04eb
......@@ -20,7 +20,8 @@ class Evaluator:
for participant in self.Exam.Participants:
if not self.is_grade_note(participant.Grade):
pts_total_part = sum(participant.Points)
grade = self.get_grade(pts_total_part, pt_limits)
bonus = participant.Bonus
grade = self.get_grade(pts_total_part, bonus, pt_limits)
participant.Grade = grade
def set_pt_limits(self, lower_bound_pct, upper_bound_pct, mode):
......@@ -53,32 +54,54 @@ class Evaluator:
return array
@staticmethod
def get_grade(self, pts, pts_array):
def get_grade(self, pts, bonus, pts_array):
"""Calculate grade from points"""
if pts < pts_array[0]:
return 5.0
elif pts_array[0] <= pts < pts_array[1]:
return 4.0
elif pts_array[1] <= pts < pts_array[2]:
return 3.7
elif pts_array[2] <= pts < pts_array[3]:
return 3.3
elif pts_array[3] <= pts < pts_array[4]:
return 3.0
elif pts_array[4] <= pts < pts_array[5]:
return 2.7
elif pts_array[5] <= pts < pts_array[6]:
return 2.3
elif pts_array[6] <= pts < pts_array[7]:
return 2.0
elif pts_array[7] <= pts < pts_array[8]:
return 1.7
elif pts_array[8] <= pts < pts_array[9]:
return 1.3
elif pts_array[9] <= pts:
return 1.0
if not bonus:
if pts_array[0] <= pts < pts_array[1]:
return 4.0
elif pts_array[1] <= pts < pts_array[2]:
return 3.7
elif pts_array[2] <= pts < pts_array[3]:
return 3.3
elif pts_array[3] <= pts < pts_array[4]:
return 3.0
elif pts_array[4] <= pts < pts_array[5]:
return 2.7
elif pts_array[5] <= pts < pts_array[6]:
return 2.3
elif pts_array[6] <= pts < pts_array[7]:
return 2.0
elif pts_array[7] <= pts < pts_array[8]:
return 1.7
elif pts_array[8] <= pts < pts_array[9]:
return 1.3
elif pts_array[9] <= pts:
return 1.0
else:
raise PointsOutOfScope()
else:
raise PointsOutOfScope()
if pts_array[0] <= pts < pts_array[1]:
return 3.7
elif pts_array[1] <= pts < pts_array[2]:
return 3.3
elif pts_array[2] <= pts < pts_array[3]:
return 3.0
elif pts_array[3] <= pts < pts_array[4]:
return 2.7
elif pts_array[4] <= pts < pts_array[5]:
return 2.3
elif pts_array[5] <= pts < pts_array[6]:
return 2.0
elif pts_array[6] <= pts < pts_array[7]:
return 1.7
elif pts_array[7] <= pts < pts_array[8]:
return 1.3
elif pts_array[8] <= pts:
return 1.0
else:
raise PointsOutOfScope()
@staticmethod
def is_grade_note(grade):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment