Changeset 11593 for main/waeup.aaue/trunk/src/waeup
- Timestamp:
- 22 Apr 2014, 20:52:00 (11 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r11004 r11593 19 19 import shutil 20 20 import tempfile 21 import grok 21 22 from StringIO import StringIO 22 23 from hurry.workflow.interfaces import IWorkflowState … … 433 434 self.assertEqual(utils.maxCredits(dummy), 48) 434 435 return 436 437 def test_set_matric_number(self): 438 site = grok.getSite() 439 utils = getUtility(IStudentsUtils) 440 site['configuration'].next_matric_integer = 1 441 self.student.matric_number = None 442 msg, mnumber = utils.setMatricNumber(self.student) 443 self.assertEqual(msg, None) 444 self.assertEqual(mnumber, 1) 445 self.assertEqual(self.student.matric_number, 'fac1/dep1/04/00001') 446 self.assertEqual(site['configuration'].next_matric_integer, 2) 447 # Part time have an extended matric number 448 self.student.matric_number = None 449 self.student['studycourse'].certificate.study_mode = 'ug_pt' 450 msg, mnumber = utils.setMatricNumber(self.student) 451 self.assertEqual(self.student.matric_number, 'PTP/fac1/dep1/04/00002') 452 # Foundation programme students don't get matric number. 453 self.student.matric_number = None 454 self.student['studycourse'].certificate.study_mode = 'found' 455 msg, mnumber = utils.setMatricNumber(self.student) 456 self.assertEqual(msg, 'Matriculation number cannot be set.') 457 self.assertEqual(mnumber, None) 458 # Certificate must be set. 459 self.student.matric_number = None 460 self.student['studycourse'].certificate = None 461 msg, mnumber = utils.setMatricNumber(self.student) 462 self.assertEqual(msg, 'No certificate assigned.') 463 return -
main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py
r11455 r11593 70 70 (4.5, '2nd Class Honours Upper Division'), 71 71 (5, '1st Class Honours')) 72 73 def _constructMatricNumber(self, student, next_integer): 74 faccode = student.faccode 75 depcode = student.depcode 76 year = unicode(student.entry_session)[2:] 77 if student.current_mode in ('ug_pt', 'de_pt'): 78 return "PTP/%s/%s/%s/%05d" % (faccode, depcode, year, next_integer) 79 if student.current_mode in ('pg_ft', 'pg_pt'): 80 return "SPS/%s/%s/%s/%05d" % (faccode, depcode, year, next_integer) 81 if student.current_mode == 'found': 82 return None 83 return "%s/%s/%s/%05d" % (faccode, depcode, year, next_integer) 72 84 73 85 def getReturningData(self, student): -
main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py
r11591 r11593 68 68 'ug_ft': 'Undergraduate Full Time', 69 69 'ug_pt': 'Undergraduate Part Time', 70 'de_ft': 'Direct Entry Full Time', 71 'de_pt': 'Direct Entry Part Time', 70 72 'dp_pt': 'Diploma Part Time', 71 73 'dp_ft': 'Diploma Full Time',
Note: See TracChangeset for help on using the changeset viewer.