Changeset 14136
- Timestamp:
- 27 Aug 2016, 06:52:44 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r14114 r14136 419 419 def _signatures(self): 420 420 return ([( 421 ' Akhimien Felicia O. (MANUPA) <br /> Principal Assistant Registrar <br /> '421 'Mrs. Uniamikogbo, S.O., mnim, manupa <br /> Prin. Asst Registrar <br /> ' 422 422 'Exams, Records and Data Processing Division <br /> For: Registrar')],) 423 423 … … 429 429 Cred = translate(_('Credits'), target_language=portal_language) 430 430 Score = translate(_('Score'), target_language=portal_language) 431 #CA = translate(_('CA'), target_language=portal_language)432 431 Grade = translate(_('Grade'), target_language=portal_language) 433 432 studentview = StudentBasePDFFormPage(self.context.student, … … 439 438 (Term, 'semester', 1.5), 440 439 (Cred, 'credits', 1.5), 441 (Score, 'score', 1.5), 442 #(CA, 'ca', 1.5), 440 (Score, 'total_score', 1.5), 443 441 (Grade, 'grade', 1.5), 444 442 ] -
main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py
r14117 r14136 36 36 37 37 38 def getGradeWeightFromScore( score, ca, student):39 if None in (score, ca):38 def getGradeWeightFromScore(total, student): 39 if total is None: 40 40 return (None, None) 41 total = score + ca42 41 if total >= 70: 43 42 return ('A',5) … … 203 202 """Returns the grade calculated from score. 204 203 """ 205 return getGradeWeightFromScore(self. score, self.ca, self.student)[0]204 return getGradeWeightFromScore(self.total_score, self.student)[0] 206 205 207 206 @property … … 209 208 """Returns the weight calculated from score. 210 209 """ 211 return getGradeWeightFromScore(self.score, self.ca, self.student)[1] 210 return getGradeWeightFromScore(self.total_score, self.student)[1] 211 212 @property 213 def total_score(self): 214 """Returns ca + score. 215 """ 216 if not None in (self.score, self.ca): 217 return self.score + self.ca 212 218 213 219 CustomCourseTicket = attrs_to_fields(CustomCourseTicket) -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r14116 r14136 367 367 open(path, 'wb').write(self.browser.contents) 368 368 print "Sample PDF coursetickets.pdf written to %s" % path 369 370 def test_transcripts(self): 371 studylevel = createObject(u'waeup.StudentStudyLevel') 372 studylevel.level = 100 373 studylevel.level_session = 2005 374 self.student['studycourse'].entry_mode = 'ug_ft' 375 self.student['studycourse'].addStudentStudyLevel( 376 self.certificate, studylevel) 377 studylevel2 = createObject(u'waeup.StudentStudyLevel') 378 studylevel2.level = 200 379 studylevel2.level_session = 2006 380 self.student['studycourse']['100']['COURSE1'].score = 33 # no carry-over! 381 self.student['studycourse']['100']['COURSE1'].ca = 22 382 self.student['studycourse'].addStudentStudyLevel( 383 self.certificate, studylevel2) 384 # Add second course (COURSE has been added automatically) 385 courseticket = createObject('waeup.CourseTicket') 386 courseticket.code = 'ANYCODE' 387 courseticket.title = u'Any TITLE' 388 courseticket.credits = 13 389 courseticket.score = 55 390 courseticket.ca = 11 391 courseticket.semester = 1 392 courseticket.dcode = u'ANYDCODE' 393 courseticket.fcode = u'ANYFCODE' 394 self.student['studycourse']['200']['COURSE2'] = courseticket 395 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.0) 396 self.assertEqual(self.student['studycourse']['200'].gpa_params_rectified[0], 4.0) 397 # Get transcript data 398 td = self.student['studycourse'].getTranscriptData() 399 self.assertEqual(td[0][0]['level_key'], '100') 400 self.assertEqual(td[0][0]['sgpa'], 3.0) 401 self.assertEqual(td[0][0]['level'].level, 100) 402 self.assertEqual(td[0][0]['level'].level_session, 2005) 403 self.assertEqual(td[0][0]['tickets_1'][0].code, 'COURSE1') 404 self.assertEqual(td[0][1]['level_key'], '200') 405 self.assertEqual(td[0][1]['sgpa'], 4.0) 406 self.assertEqual(td[0][1]['level'].level, 200) 407 self.assertEqual(td[0][1]['level'].level_session, 2006) 408 self.assertEqual(td[0][1]['tickets_1'][0].code, 'ANYCODE') 409 self.assertEqual(td[1], 3.57) 410 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 411 self.browser.open(self.student_path + '/studycourse/transcript') 412 self.assertEqual(self.browser.headers['Status'], '200 Ok') 413 self.assertTrue('Transcript' in self.browser.contents) 414 # Officers can open the pdf transcript 415 self.browser.open(self.student_path + '/studycourse/transcript.pdf') 416 self.assertEqual(self.browser.headers['Status'], '200 Ok') 417 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 418 path = os.path.join(samples_dir(), 'transcript.pdf') 419 open(path, 'wb').write(self.browser.contents) 420 print "Sample PDF transcript.pdf written to %s" % path 369 421 370 422 class StudentUITests(StudentsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.