- Timestamp:
- 19 Apr 2016, 06:42:26 (9 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r13795 r13834 31 31 CourseTicketAddFormPage, 32 32 StudyLevelDisplayFormPage, 33 StudyLevelManageFormPage, 34 StudyLevelEditFormPage, 33 35 ExportPDFTranscriptSlip, 34 36 ExportPDFAdmissionSlip, … … 204 206 'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 205 207 208 class CustomStudyLevelManageFormPage(StudyLevelManageFormPage): 209 """ Page to edit the student study level data 210 """ 211 grok.context(ICustomStudentStudyLevel) 212 213 class CustomStudyLevelEditFormPage(StudyLevelEditFormPage): 214 """ Page to edit the student study level data by students 215 """ 216 grok.context(ICustomStudentStudyLevel) 217 206 218 class CustomExportPDFCourseRegistrationSlip( 207 219 NigeriaExportPDFCourseRegistrationSlip): … … 289 301 Cred = translate('Cred.', 'waeup.kofa', target_language=portal_language) 290 302 Score = translate('Score', 'waeup.kofa', target_language=portal_language) 303 CA = translate('CA', 'waeup.kofa', target_language=portal_language) 291 304 Grade = translate('Grade', 'waeup.kofa', target_language=portal_language) 292 305 Signature = translate(_('Lecturer\'s Signature'), 'waeup.aaue', … … 307 320 (Cred, 'credits', 1.5), 308 321 (Score, 'score', 1.4), 322 (CA, 'ca', 1.4), 309 323 (Grade, 'grade', 1.4), 310 324 (Signature, 'dummy', 3), … … 337 351 'Akhimien Felicia O. (MANUPA) <br /> Principal Assistant Registrar <br /> ' 338 352 'Exams, Records and Data Processing Division <br /> For: Registrar')],) 353 354 def render(self): 355 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 356 Term = translate(_('Term'), 'waeup.kofa', target_language=portal_language) 357 Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) 358 Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) 359 Cred = translate(_('Credits'), 'waeup.kofa', target_language=portal_language) 360 Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language) 361 CA = translate(_('CA'), 'waeup.kofa', target_language=portal_language) 362 Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) 363 studentview = StudentBasePDFFormPage(self.context.student, 364 self.request, self.omit_fields) 365 students_utils = getUtility(IStudentsUtils) 366 367 tableheader = [(Code,'code', 2.5), 368 (Title,'title', 7), 369 (Term, 'semester', 1.5), 370 (Cred, 'credits', 1.5), 371 (Score, 'score', 1.5), 372 (CA, 'ca', 1.5), 373 (Grade, 'grade', 1.5), 374 ] 375 376 return students_utils.renderPDFTranscript( 377 self, 'transcript.pdf', 378 self.context.student, studentview, 379 omit_fields=self.omit_fields, 380 tableheader=tableheader, 381 signatures=self._signatures(), 382 sigs_in_footer=self._sigsInFooter(), 383 ) 339 384 340 385 class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): -
main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py
r13795 r13834 304 304 305 305 ca = schema.Int( 306 title = _(u'C ontinuous Assessment'),306 title = _(u'CA'), 307 307 default = None, 308 308 required = False, … … 310 310 ) 311 311 312 ICustomCourseTicket['ca'].order = ICustomCourseTicket[' mandatory'].order312 ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order 313 313 314 314 class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): -
main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py
r13071 r13834 36 36 37 37 38 def getGradeWeightFromScore(score, ca): 39 if None in (score, ca): 40 return (None, None) 41 total = score + ca 42 if total >= 70: 43 return ('A',5) 44 if total >= 60: 45 return ('B',4) 46 if total >= 50: 47 return ('C',3) 48 if total >= 45: 49 return ('D',2) 50 if total >= 40: 51 return ('E',1) 52 return ('F',0) 53 54 38 55 class CustomStudentStudyLevel(StudentStudyLevel): 39 56 """This is a container for course tickets. … … 57 74 total += ticket.credits 58 75 return total 76 77 @property 78 def gpa_params(self): 79 """Calculate gpa parameters for this level. 80 """ 81 credits_weighted = 0.0 82 credits_counted = 0 83 level_gpa = 0.0 84 for ticket in self.values(): 85 if None not in (ticket.score, ticket.ca): 86 credits_counted += ticket.credits 87 credits_weighted += ticket.credits * ticket.weight 88 if credits_counted: 89 level_gpa = round(credits_weighted/credits_counted, 3) 90 return level_gpa, credits_counted, credits_weighted 59 91 60 92 @property … … 111 143 grok.provides(ICustomCourseTicket) 112 144 145 @property 146 def grade(self): 147 """Returns the grade calculated from score. 148 """ 149 return getGradeWeightFromScore(self.score, self.ca)[0] 150 151 @property 152 def weight(self): 153 """Returns the weight calculated from score. 154 """ 155 return getGradeWeightFromScore(self.score, self.ca)[1] 156 113 157 CustomCourseTicket = attrs_to_fields(CustomCourseTicket) 114 158 -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r13786 r13834 86 86 # First course has been added automatically. 87 87 # Set score. 88 studylevel['COURSE1'].score = 55 88 studylevel['COURSE1'].score = 35 89 studylevel['COURSE1'].ca = 20 89 90 # GPA is 3.0. 90 91 self.assertEqual(studylevel.gpa_params[0], 3.0) … … 93 94 courseticket.title = u'Any TITLE' 94 95 courseticket.credits = 13 95 courseticket.score = 66 96 courseticket.score = 44 97 courseticket.ca = 22 96 98 courseticket.semester = 1 97 99 courseticket.dcode = u'ANYDCODE'
Note: See TracChangeset for help on using the changeset viewer.