- Timestamp:
- 8 Jan 2019, 17:56:31 (6 years ago)
- 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
r15176 r15284 41 41 self.certificate.study_mode ='nd_ft' 42 42 msg, mnumber = utils.setMatricNumber(self.student) 43 self.assertEqual(self.student.matric_number, ' ESITM/fac1/dep1/04/00001')43 self.assertEqual(self.student.matric_number, 'fac1/ND/04/00001') 44 44 self.assertEqual(msg, None) 45 45 # hnd_ft … … 47 47 self.certificate.study_mode ='hnd_ft' 48 48 msg, mnumber = utils.setMatricNumber(self.student) 49 self.assertEqual(self.student.matric_number, ' ESITM/fac1/dep1/HND/04/00001')49 self.assertEqual(self.student.matric_number, 'fac1/HD/04/00001') 50 50 self.assertEqual(msg, None) 51 51 # nd_pt … … 53 53 self.certificate.study_mode ='nd_pt' 54 54 msg, mnumber = utils.setMatricNumber(self.student) 55 self.assertEqual(self.student.matric_number, ' ESITM/PT-ND/fac1/dep1/04/00001')55 self.assertEqual(self.student.matric_number, 'fac1/PT/04/00001') 56 56 self.assertEqual(msg, None) 57 57 return -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py
r15223 r15284 235 235 def constructMatricNumber(self, student): 236 236 faccode = student.faccode 237 depcode = student.depcode238 certcode = student.certcode237 #depcode = student.depcode 238 #certcode = student.certcode 239 239 year = unicode(student.entry_session)[2:] 240 240 if not student.state in (PAID, ) or not student.is_fresh: 241 241 return _('Matriculation number cannot be set.'), None 242 242 243 # ESITM/ENG/MEC/11/5367243 # SASND1809001 244 244 if student.current_mode == 'nd_ft': 245 245 next_integer = grok.getSite()['configuration'].next_matric_integer 246 246 if next_integer == 0: 247 247 return _('Matriculation number cannot be set.'), None 248 return None, "ESITM/%s/%s/%s/%05d" % ( 249 faccode, depcode, year, next_integer) 250 251 # ESITM/ENG/MEC/HND/11/5367 248 return None, "%s/ND/%s/%05d" % (faccode, year, next_integer) 249 250 # SASNH1809001 252 251 if student.current_mode == 'hnd_ft': 253 252 next_integer = grok.getSite()['configuration'].next_matric_integer_2 254 253 if next_integer == 0: 255 254 return _('Matriculation number cannot be set.'), None 256 return None, "ESITM/%s/%s/HND/%s/%05d" % ( 257 faccode, depcode, year, next_integer) 258 259 # ESITM/PT-ND/ENG/MEC/11/5367 260 if student.current_mode == 'nd_pt': 255 return None, "%s/HD/%s/%05d" % (faccode, year, next_integer) 256 257 # SASPT1809001 258 if student.current_mode in ('nd_pt', 'hnd_pt'): 261 259 next_integer = grok.getSite()['configuration'].next_matric_integer_3 262 260 if next_integer == 0: 263 261 return _('Matriculation number cannot be set.'), None 264 return None, "ESITM/PT-ND/%s/%s/%s/%05d" % ( 265 faccode, depcode, year, next_integer) 266 267 # ??? 268 if student.current_mode == 'hnd_pt': 269 pass 262 return None, "%s/PT/%s/%05d" % (faccode, year, next_integer) 270 263 271 264 return _('Matriculation number cannot be set.'), None
Note: See TracChangeset for help on using the changeset viewer.