def test_scaled_multiple_mp_average(self):
     test_data = [
         [[self.data.mp1.id, self.data.mp2.id, self.data.mps1x.id], Decimal(1.9)],
         [[self.data.mp3.id, self.data.mp4.id, self.data.mps2x.id], Decimal(2.1)],
     ]
     for x in test_data:
         average = Grade.get_scaled_multiple_mp_average(self.data.student, x[0], rounding=1)
         self.assertAlmostEqual(average, x[1])
Beispiel #2
0
 def get_scaled_multiple_mp_average_by_indices(self, indices, rounding=2):
     """ Get a scaled mulitple marking period average for this student
     Requires that the property mps be set previously.
     This function exists mainly for appy based report cards where speed,
     and simplicity (in the template) are important.
     """
     from ecwsp.grades.models import Grade
     mps = [ self.mps[i] for i in indices ]
     return Grade.get_scaled_multiple_mp_average(self, mps, rounding)