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

Customize increaseMatricInteger.

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

Legend:

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

    r15284 r15344  
    3636        site['configuration'].next_matric_integer_2 = 1
    3737        site['configuration'].next_matric_integer_3 = 1
    38         site['configuration'].next_matric_integer_4 = 1
    3938        self.student.matric_number = None
    4039        # nd_ft
     
    4241        msg, mnumber = utils.setMatricNumber(self.student)
    4342        self.assertEqual(self.student.matric_number, 'fac1/ND/04/00001')
     43        self.assertEqual(site['configuration'].next_matric_integer, 2)
    4444        self.assertEqual(msg, None)
    4545        # hnd_ft
     
    4848        msg, mnumber = utils.setMatricNumber(self.student)
    4949        self.assertEqual(self.student.matric_number, 'fac1/HD/04/00001')
     50        self.assertEqual(site['configuration'].next_matric_integer_2, 2)
    5051        self.assertEqual(msg, None)
    5152        # nd_pt
     
    5455        msg, mnumber = utils.setMatricNumber(self.student)
    5556        self.assertEqual(self.student.matric_number, 'fac1/PT/04/00001')
     57        self.assertEqual(site['configuration'].next_matric_integer_3, 2)
    5658        self.assertEqual(msg, None)
    5759        return
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py

    r15301 r15344  
    9393        req_payments_titles = 'ICT and Logbook'
    9494        if len(student['payments']):
    95             # All ND and HND part time do not pay LOGBOOK
     95            # All ND and HND part time do not pay for LOGBOOK
    9696            if student.current_mode.endswith('_pt'):
    9797                req_payments = ('ict_entre',)
    9898                req_payments_titles = 'ICT'
    99             # HND2 full time do not pay for SIWES
    100             #elif student.current_mode == 'hnd_ft' and student.state == RETURNING:
    101             #    req_payments = ('ict_entre', 'logbook_combo')
    102             #    req_payments_titles = 'ICT and Logbook'
    103             # HND1 full time do not pay both LOGBOOK
    104             elif student.current_mode == 'hnd_ft' and student.state == CLEARED:
     99            # HND1 and HND2 full time do not pay for LOGBOOK
     100            elif student.current_mode == 'hnd_ft' and student.state in (
     101                CLEARED, RETURNING):
    105102                req_payments = ('ict_entre',)
    106103                req_payments_titles = 'ICT'
    107             # ND2 FULL TIME Do not pay LOGBOOK
     104            # ND2 FULL TIME do not pay LOGBOOK
    108105            elif student.current_mode == 'nd_ft' and student.state == RETURNING:
    109106                req_payments = ('ict_entre',)
    110107                req_payments_titles = 'ICT'
    111             # ND1 full time do not pay SIWES
    112             #elif student.current_mode == 'nd_ft' and student.state == CLEARED:
    113             #    req_payments = ('ict_entre', 'logbook_combo')
    114             #    req_payments_titles = 'ICT and Logbook'
    115108            num = 0
    116109            for ticket in student['payments'].values():
     
    265258        return _('Matriculation number cannot be set.'), None
    266259
     260
     261    def increaseMatricInteger(self, student):
     262        """Increase counter for matric numbers.
     263        """
     264        if student.current_mode == 'nd_ft':
     265            grok.getSite()['configuration'].next_matric_integer += 1
     266            return
     267        elif student.current_mode == 'hnd_ft':
     268            grok.getSite()['configuration'].next_matric_integer_2 += 1
     269            return
     270        elif student.current_mode in ('nd_pt', 'hnd_pt'):
     271            grok.getSite()['configuration'].next_matric_integer_3 += 1
     272            return
     273        return
     274
    267275    def getAccommodationDetails(self, student):
    268276        """Determine the accommodation data of a student.
Note: See TracChangeset for help on using the changeset viewer.