Changeset 9962 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 16 Feb 2013, 18:22:16 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r9960 r9962 428 428 entry_mode = row.get('entry_mode', None) 429 429 certificate = row.get('certificate', None) 430 # If students are being transferred a new studycourse is created and431 # the old one is moved.430 current_session = row.get('current_session', None) 431 student = self.getParent(row, site) 432 432 if entry_mode == 'transfer': 433 studycourse = createObject(u'waeup.StudentStudyCourse') 434 student = obj.__parent__ 435 studycourse.entry_session = obj.entry_session 436 if 'studycourse_1' in student.keys(): 437 student['studycourse_2'] = obj 438 else: 439 student['studycourse_1'] = obj 440 del student['studycourse'] 441 student['studycourse'] = studycourse 442 student.__parent__.logger.info( 443 '%s - transferred from %s to %s' % ( 444 student.student_id, obj.certificate.code, certificate.code)) 445 history = IObjectHistory(student) 446 history.addMessage('Transferred from %s to %s' % ( 447 obj.certificate.code, certificate.code)) 433 # We do not expect any error here since we 434 # checked all constraints in checkConversion and 435 # in checkUpdateRequirements 436 student.transfer( 437 certificate=certificate, current_session=current_session) 448 438 obj = student['studycourse'] 449 439 items_changed = super(StudentStudyCourseProcessor, self).updateEntry( 450 440 obj, row, site, filename) 451 parent = self.getParent(row, site) 452 parent.__parent__.logger.info( 441 student.__parent__.logger.info( 453 442 '%s - %s - %s - updated: %s' 454 % (self.name, filename, parent.student_id, items_changed))443 % (self.name, filename, student.student_id, items_changed)) 455 444 # Update the students_catalog 456 notify(grok.ObjectModifiedEvent( obj.__parent__))445 notify(grok.ObjectModifiedEvent(student)) 457 446 return 458 447 -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r9960 r9962 460 460 ) 461 461 462 entry_mode = schema.Choice(463 title = _(u'Entry Mode'),464 source = StudyModeSource(),465 required = False,466 readonly = False,467 )468 469 462 entry_session = schema.Choice( 470 463 title = _(u'Entry Session'), -
main/waeup.kofa/trunk/src/waeup/kofa/students/student.py
r9761 r9962 225 225 226 226 """ 227 studycourse = createObject(u'waeup.StudentStudyCourse')227 newcourse = createObject(u'waeup.StudentStudyCourse') 228 228 try: 229 studycourse.certificate = certificate230 studycourse.entry_mode = 'transfer'231 studycourse.current_session = current_session232 studycourse.current_level = current_level233 studycourse.current_verdict = current_verdict234 studycourse.previous_verdict = previous_verdict229 newcourse.certificate = certificate 230 newcourse.entry_mode = 'transfer' 231 newcourse.current_session = current_session 232 newcourse.current_level = current_level 233 newcourse.current_verdict = current_verdict 234 newcourse.previous_verdict = previous_verdict 235 235 except ConstraintNotSatisfied: 236 236 return -1 237 old = self['studycourse']238 if getattr(old , 'entry_session', None) is None or\239 getattr(old , 'certificate', None) is None:237 oldcourse = self['studycourse'] 238 if getattr(oldcourse, 'entry_session', None) is None or\ 239 getattr(oldcourse, 'certificate', None) is None: 240 240 return -2 241 studycourse.entry_session = old.entry_session241 newcourse.entry_session = oldcourse.entry_session 242 242 # Students can be transferred only two times. 243 243 if 'studycourse_1' in self.keys(): 244 244 if 'studycourse_2' in self.keys(): 245 245 return -3 246 self['studycourse_2'] = old 246 self['studycourse_2'] = oldcourse 247 247 else: 248 self['studycourse_1'] = old 248 self['studycourse_1'] = oldcourse 249 249 del self['studycourse'] 250 self['studycourse'] = studycourse250 self['studycourse'] = newcourse 251 251 self.__parent__.logger.info( 252 252 '%s - transferred from %s to %s' % ( 253 self.student_id, old .certificate.code, studycourse.certificate.code))253 self.student_id, oldcourse.certificate.code, newcourse.certificate.code)) 254 254 history = IObjectHistory(self) 255 255 history.addMessage('Transferred from %s to %s' % ( 256 old .certificate.code, studycourse.certificate.code))256 oldcourse.certificate.code, newcourse.certificate.code)) 257 257 return 258 258
Note: See TracChangeset for help on using the changeset viewer.