Ignore:
Timestamp:
6 Mar 2019, 21:33:16 (6 years ago)
Author:
Henrik Bettermann
Message:

Customize increaseMatricInteger.

Location:
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_utils.py

    r15288 r15345  
    4242        msg, mnumber = utils.setMatricNumber(self.student)
    4343        self.assertEqual(self.student.matric_number, 'dep1/ND/04/00001')
     44        self.assertEqual(site['configuration'].next_matric_integer, 2)
    4445        self.assertEqual(msg, None)
    4546        # hnd_ft
     
    4849        msg, mnumber = utils.setMatricNumber(self.student)
    4950        self.assertEqual(self.student.matric_number, 'dep1/HND/04/00001')
     51        self.assertEqual(site['configuration'].next_matric_integer_2, 2)
    5052        self.assertEqual(msg, None)
    5153        # nd_pt
     
    5456        msg, mnumber = utils.setMatricNumber(self.student)
    5557        self.assertEqual(self.student.matric_number, 'dep1/ND/04/10001')
     58        self.assertEqual(site['configuration'].next_matric_integer_3, 10002)
    5659        self.assertEqual(msg, None)
    5760        # hnd_pt
     
    6063        msg, mnumber = utils.setMatricNumber(self.student)
    6164        self.assertEqual(self.student.matric_number, 'dep1/HND/04/10001')
     65        self.assertEqual(site['configuration'].next_matric_integer_4, 10002)
    6266        self.assertEqual(msg, None)
    6367        return
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py

    r15288 r15345  
    317317
    318318        return _('Matriculation number cannot be set.'), None
     319
     320    def increaseMatricInteger(self, student):
     321        """Increase counter for matric numbers.
     322        """
     323        if student.current_mode == 'nd_ft':
     324            grok.getSite()['configuration'].next_matric_integer += 1
     325            return
     326        elif student.current_mode == 'hnd_ft':
     327            grok.getSite()['configuration'].next_matric_integer_2 += 1
     328            return
     329        elif student.current_mode in ('nd_pt, nd_we'):
     330            grok.getSite()['configuration'].next_matric_integer_3 += 1
     331            return
     332        elif student.current_mode in ('hnd_pt, hnd_we'):
     333            grok.getSite()['configuration'].next_matric_integer_4 += 1
     334            return
     335        return
Note: See TracChangeset for help on using the changeset viewer.