Changeset 2979 for WAeUP_SRP/base/skins
- Timestamp:
- 5 Jan 2008, 15:01:33 (17 years ago)
- Location:
- WAeUP_SRP/base/skins/waeup_utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_utilities/fix_lgas.py
r2978 r2979 66 66 logger.info("found %d students" % total) 67 67 count = 0 68 commit_after = 5069 logger.info('started to fix %d lga' % total)68 commit_after = 100 69 logger.info('started to fix %d records in students_catalog' % total) 70 70 d,states,lgas = getLGAs() 71 71 d = {} … … 76 76 continue 77 77 if student_record.lga.startswith('no state'): 78 logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id)) 78 79 continue 79 80 #rwrite("%s: %s" % (student_record.id,student_record.lga)) 80 81 sl = student_record.lga.split('/') 81 82 if len(sl) != 2: 83 logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id)) 82 84 #rwrite("wrong size %s: %s" % (student_record.id,sl)) 83 85 continue … … 85 87 lga = sl[1].lower().strip() 86 88 if not lga or not state: 89 logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id)) 87 90 continue 88 91 count += 1 89 92 if len(d) and not len(d) % commit_after: 90 logger.info("found %d correct of %d sofar" % (len(d),count))93 logger.info("found %d correct of %d so far" % (len(d),count)) 91 94 state_lga = state + '_' + lga 92 95 if state in states: … … 101 104 break 102 105 if found: 103 msg = "found %s for %s" % (state_lga,student_record.id)106 #msg = "found %s for %s" % (state_lga,student_record.id) 104 107 d[student_record.id] = state_lga 105 else:106 msg = "no '%s' '%s' for %s" % (state,lga,student_record.id)108 #else: 109 #msg = "no '%s' '%s' for %s" % (state,lga,student_record.id) 107 110 #rwrite(msg) 108 else:109 msg = "no state '%s' '%s' for %s" % (state,lga,student_record.id)111 #else: 112 #msg = "no state '%s' '%s' for %s" % (state,lga,student_record.id) 110 113 #rwrite(msg) 111 114 # if count > 150: -
WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve.py
r2972 r2979 65 65 student_records = aq_students(query) 66 66 total = len(student_records) 67 logger.info("found %d with empty clearance lga" % total)67 logger.info("found %d records with empty clearance lga" % total) 68 68 count = 0 69 commit_after = 5070 logger.info('started to fix %d lga' % total)69 commit_after = 100 70 logger.info('started to fix %d records' % total) 71 71 d,states,lgas = getLGAs() 72 72 d = {} … … 74 74 count += 1 75 75 if len(d) and not len(d) % commit_after: 76 logger.info("found %d correct of %d sofar" % (len(d),count))76 logger.info("found %d correct lga values of %d so far" % (len(d),count)) 77 77 jamb_state = getattr(getattr(students_folder,student_record.id),'application').getContent().jamb_state 78 78 jamb_lga = getattr(getattr(students_folder,student_record.id),'application').getContent().jamb_lga … … 82 82 if jamb_state and jamb_lga and jamb_state in states and jamb_lga in lgas: 83 83 d[student_record.id] = lga 84 else:85 msg = "no %s for %s" % (lga,student_record.id)86 pass84 #else: 85 # msg = "no %s for %s" % (lga,student_record.id) 86 # pass 87 87 # rwrite(msg) 88 88 # if count > 150: 89 89 # break 90 logger.info("found %d correct lga s" % len(d))90 logger.info("found %d correct lga values" % len(d)) 91 91 edited = 1 92 92 for student_id,lga in d.items(): 93 msg = "set clearance.lga to %s for %s" % (lga,student _record.id)93 msg = "set clearance.lga to %s for %s" % (lga,student.id) 94 94 getattr(getattr(students_folder,student_id),'clearance').getContent().edit(mapping={'lga':lga}) 95 95 logger.info(msg)
Note: See TracChangeset for help on using the changeset viewer.