Changeset 3376 for WAeUP_SRP/base/skins/waeup_utilities
- Timestamp:
- 26 Mar 2008, 10:11:44 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_utilities/ti_507_resolve.py
r3368 r3376 22 22 return 23 23 24 25 24 import logging 26 25 import DateTime … … 38 37 count = 0 39 38 found = 0 40 commit_after = 1000 0039 commit_after = 1000 41 40 certificates = context.getCertificatesDict() 42 41 students = context.students_catalog() 43 wrong = []42 wrong = {} 44 43 missing_courses = [] 45 44 wrong_modes = {} … … 64 63 w_count += 1 65 64 wrong_modes[(current_mode,study_mode)] = w_count 66 wrong += student.id, 67 if wrong and not (len(wrong) % commit_after): 68 logger.info('found %d wrong of %d' % (len(wrong),count)) 65 d = {} 66 d['student_id'] = student.id 67 d['current_mode'] = study_mode 68 d['current_mode_old'] = current_mode 69 wrong[student.id] = d 70 # if wrong and not (len(wrong) % commit_after): 71 # logger.info('found %d wrong of %d' % (len(wrong),count)) 69 72 for k,v in wrong_modes.items(): 70 73 logger.info('wrong mode %s counted %d' % (k,v)) 71 74 logger.info('missing courses %s (%d counted)' % (', '.join(missing_courses),len(students_with_missing_courses))) 72 75 logger.info('found %d wrong of %d' % (len(wrong),count)) 76 count = 0 77 for student_id,d in wrong.items(): 78 #set_trace() 79 try: 80 getattr(getattr(students_folder,student_id),'study_course').getContent().edit(mapping=d) 81 failed = False 82 except: 83 failed = True 84 if failed: 85 logger.info("%(student_id)s change failed") 86 else: 87 logger.info("%(student_id)s changed current_mode from %(current_mode_old)s to %(current_mode)s" % d) 88 if count and not count % commit_after: 89 context.waeup_tool.doCommit() 90 logger.info("committing %d of total %d" % (commit_after,count)) 91 count += 1
Note: See TracChangeset for help on using the changeset viewer.