Changeset 14075
- Timestamp:
- 13 Aug 2016, 03:23:04 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py
r13834 r14075 31 31 StudentStudyLevel, CourseTicket, 32 32 CourseTicketFactory, StudentStudyLevelFactory) 33 from waeup.kofa.students.interfaces import IStudentNavigation 33 from waeup.kofa.students.interfaces import IStudentNavigation, ICourseTicket 34 34 from waeup.aaue.students.interfaces import ( 35 35 ICustomStudentStudyLevel, ICustomCourseTicket) 36 36 37 37 38 def getGradeWeightFromScore(score, ca ):38 def getGradeWeightFromScore(score, ca, student): 39 39 if None in (score, ca): 40 40 return (None, None) … … 48 48 if total >= 45: 49 49 return ('D',2) 50 if total >= 40 :50 if total >= 40 and student.entry_session < 2013: 51 51 return ('E',1) 52 52 return ('F',0) … … 116 116 return False 117 117 118 def addCourseTicket(self, ticket, course): 119 """Add a course ticket object. 120 """ 121 if not ICourseTicket.providedBy(ticket): 122 raise TypeError( 123 'StudentStudyLeves contain only ICourseTicket instances') 124 ticket.code = course.code 125 ticket.title = course.title 126 ticket.fcode = course.__parent__.__parent__.__parent__.code 127 ticket.dcode = course.__parent__.__parent__.code 128 ticket.credits = course.credits 129 if self.student.entry_session < 2013: 130 ticket.passmark = course.passmark - 5 131 else: 132 ticket.passmark = course.passmark 133 ticket.semester = course.semester 134 self[ticket.code] = ticket 135 return 136 118 137 CustomStudentStudyLevel = attrs_to_fields( 119 138 CustomStudentStudyLevel, omit=[ … … 147 166 """Returns the grade calculated from score. 148 167 """ 149 return getGradeWeightFromScore(self.score, self.ca )[0]168 return getGradeWeightFromScore(self.score, self.ca, self.student)[0] 150 169 151 170 @property … … 153 172 """Returns the weight calculated from score. 154 173 """ 155 return getGradeWeightFromScore(self.score, self.ca )[1]174 return getGradeWeightFromScore(self.score, self.ca, self.student)[1] 156 175 157 176 CustomCourseTicket = attrs_to_fields(CustomCourseTicket) -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r14000 r14075 145 145 # sgpa = 82 / 23 146 146 self.assertEqual(self.student['studycourse']['100'].gpa_params[0], 3.565) 147 return 148 149 def test_grade_weight(self): 150 studylevel = createObject(u'waeup.StudentStudyLevel') 151 studylevel.level = 100 152 studylevel.level_session = 2005 153 self.student['studycourse'].entry_mode = 'ug_ft' 154 self.student['studycourse'].addStudentStudyLevel( 155 self.certificate, studylevel) 156 studylevel['COURSE1'].score = 42 157 studylevel['COURSE1'].ca = 0 158 courseticket = createObject('waeup.CourseTicket') 159 self.assertEqual(studylevel['COURSE1'].weight, 1) 160 self.assertEqual(studylevel['COURSE1'].grade, 'E') 161 self.student['studycourse'].entry_session = 2015 162 self.assertEqual(studylevel['COURSE1'].weight, 0) 163 self.assertEqual(studylevel['COURSE1'].grade, 'F') 164 studylevel['COURSE1'].score = 45 165 self.assertEqual(studylevel['COURSE1'].weight, 2) 166 self.assertEqual(studylevel['COURSE1'].grade, 'D') 147 167 return 148 168
Note: See TracChangeset for help on using the changeset viewer.