Changeset 13609


Ignore:
Timestamp:
13 Jan 2016, 09:16:36 (9 years ago)
Author:
Henrik Bettermann
Message:

Implement matric number constructor for pg students.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_utils.py

    r13594 r13609  
    128128        site['configuration'].next_matric_integer = 1
    129129        site['configuration'].next_matric_integer_2 = 1
     130        site['configuration'].next_matric_integer_3 = 1
    130131        self.student.matric_number = None
    131132        # Regular ft students have a matric number without leading constant.
     
    140141        self.assertEqual(self.student.matric_number, 'PTP/fac1/dep1/04/00001')
    141142        self.assertEqual(site['configuration'].next_matric_integer, 2)
    142         # Students in faculty FBM an extended matric number with leading 'CMS'
     143        # Students in faculty FBM get an extended matric number with leading 'CMS'
    143144        # and the regular counter which is next_matric_integer_2.
    144145        self.app['faculties']['fac1'].code = 'FBM'
     
    148149        self.assertEqual(self.student.matric_number, 'CMS/FBM/dep1/04/00002')
    149150        self.assertEqual(site['configuration'].next_matric_integer_2, 3)
     151        # PG Students get an extended matric number with leading 'AAU/SPS'
     152        # and the pg  counter which is next_matric_integer_3.
     153        self.app['faculties']['fac1'].code = 'ABC'
     154        self.student['studycourse'].certificate.study_mode = 'special_pg_ft'
     155        self.student.matric_number = None
     156        msg, mnumber = utils.setMatricNumber(self.student)
     157        self.assertEqual(self.student.matric_number, 'AAU/SPS/ABC/dep1/04/CERT1/00001')
     158        self.assertEqual(site['configuration'].next_matric_integer_3, 2)
    150159        # Foundation programme students don't get matric number.
    151160        self.student.matric_number = None
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r13594 r13609  
    5151            grok.getSite()['configuration'].next_matric_integer += 1
    5252            return
     53        elif student.is_postgrad:
     54            grok.getSite()['configuration'].next_matric_integer_3 += 1
     55            return
    5356        grok.getSite()['configuration'].next_matric_integer_2 += 1
    5457        return
     
    5760        faccode = student.faccode
    5861        depcode = student.depcode
     62        certcode = student.certcode
    5963        year = unicode(student.entry_session)[2:]
    6064        if not student.state in (PAID, ) or not student.is_fresh or \
     
    6266            return _('Matriculation number cannot be set.'), None
    6367        if student.is_postgrad:
    64             return _('Matriculation number cannot be set.'), None
     68            next_integer = grok.getSite()['configuration'].next_matric_integer_3
     69            if next_integer == 0:
     70                return _('Matriculation number cannot be set.'), None
     71            return None, "AAU/SPS/%s/%s/%s/%s/%05d" % (
     72                faccode, depcode, year, certcode, next_integer)
    6573        if student.current_mode in ('ug_pt', 'de_pt'):
    6674            next_integer = grok.getSite()['configuration'].next_matric_integer
Note: See TracChangeset for help on using the changeset viewer.