Ignore:
Timestamp:
22 Apr 2014, 20:52:00 (11 years ago)
Author:
Henrik Bettermann
Message:

AAUE matric number construction scheme applied by customization of _constructMatricNumber.

Two more study modes added.

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  
    1919import shutil
    2020import tempfile
     21import grok
    2122from StringIO import StringIO
    2223from hurry.workflow.interfaces import IWorkflowState
     
    433434        self.assertEqual(utils.maxCredits(dummy), 48)
    434435        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  
    7070                      (4.5, '2nd Class Honours Upper Division'),
    7171                      (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)
    7284
    7385    def getReturningData(self, student):
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r11591 r11593  
    6868        'ug_ft': 'Undergraduate Full Time',
    6969        'ug_pt': 'Undergraduate Part Time',
     70        'de_ft': 'Direct Entry Full Time',
     71        'de_pt': 'Direct Entry Part Time',
    7072        'dp_pt': 'Diploma Part Time',
    7173        'dp_ft': 'Diploma Full Time',
Note: See TracChangeset for help on using the changeset viewer.