- Timestamp:
- 28 Jan 2012, 14:19:49 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/batching.py
r7522 r7532 36 36 IObjectHistory) 37 37 from waeup.sirp.students.interfaces import ( 38 IStudent, IStudentStudyCourse Import,38 IStudent, IStudentStudyCourse, 39 39 IStudentUpdateByRegNo, IStudentUpdateByMatricNo) 40 40 from waeup.sirp.students.workflow import IMPORTABLE_STATES … … 214 214 215 215 name = u'StudentStudyCourse Importer (update only)' 216 iface = IStudentStudyCourse Import216 iface = IStudentStudyCourse 217 217 factory_name = 'waeup.StudentStudyCourse' 218 218 … … 293 293 return 294 294 295 def checkConversion(self, row, mode='ignore'): 296 """Validates all values in row. 297 """ 298 converter = IObjectConverter(self.iface) 299 errs, inv_errs, conv_dict = converter.fromStringDict( 300 row, self.factory_name) 301 # We have to check if current_level is in range of certificate. 302 # This is not done by the converter. 303 certificate = conv_dict['certificate'] 304 start_level = certificate.start_level 305 end_level = certificate.end_level 306 if conv_dict['current_level'] < start_level or \ 307 conv_dict['current_level'] > end_level: 308 errs.append(('current_level','not in range')) 309 return errs, inv_errs, conv_dict 310 -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r7523 r7532 305 305 ) 306 306 307 class IStudentStudyCourseImport(IStudentStudyCourse):308 """A container for student study levels.309 310 """311 current_level = schema.Int(312 title = u'Current Level',313 default = None,314 )315 316 307 class IStudentStudyLevel(ISIRPObject): 317 308 """A container for course tickets. -
main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py
r7523 r7532 37 37 38 38 def study_levels(studycourse): 39 try:39 if studycourse.certificate is not None: 40 40 start_level = int(studycourse.certificate.start_level) 41 41 end_level = int(studycourse.certificate.end_level) 42 levels = [level for level in range(start_level,end_level+200,10) 43 if level % 100 < 30 and level < end_level + 120] 44 return levels 45 except AttributeError: 46 return [] 42 else: 43 start_level = 0 44 end_level = 600 45 levels = [level for level in range(start_level,end_level+200,10) 46 if level % 100 < 30 and level < end_level + 120] 47 return levels 48 47 49 48 50 class StudyLevelSource(BasicContextualSourceFactory): … … 60 62 61 63 def getTitle(self, context, value): 62 end_level = int(context.certificate.end_level) 64 if context.certificate is not None: 65 end_level = int(context.certificate.end_level) 66 else: 67 end_level = 600 63 68 level,repeat = divmod(value, 100) 64 69 level = level * 100
Note: See TracChangeset for help on using the changeset viewer.