Changeset 3014 for WAeUP_SRP/base/skins
- Timestamp:
- 11 Jan 2008, 20:18:17 (17 years ago)
- Location:
- WAeUP_SRP/base/skins/waeup_utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part1.py
r3009 r3014 57 57 jamb_lga = getattr(getattr(students_folder,student_record.id),'application').getContent().jamb_lga 58 58 words = ' '.join((jamb_state, jamb_lga)) 59 words = re_split('[^a-zA-Z0-9/]',words) 60 lga_words = [] 61 for word in words: 62 if word: 63 lga_words += word.lower(), 64 lga_words.sort() 65 state_lga = '' 66 while not state_lga: 67 for k,l in words_dict.items(): 68 if lga_words == l: 69 state_lga = k 70 break 71 break 59 # words = re_split('[^a-zA-Z0-9/]',words) 60 # lga_words = [] 61 # for word in words: 62 # if word: 63 # lga_words += word.lower(), 64 # lga_words.sort() 65 # state_lga = '' 66 # while not state_lga: 67 # for k,l in words_dict.items(): 68 # if lga_words == l: 69 # state_lga = k 70 # break 71 # break 72 state_lga = context.waeup_tool.findLga(words,words_dict) 72 73 if state_lga: 73 74 msg = "found %s is %s for %s " % (state_lga,student_record.lga,student_record.id) … … 78 79 logger.info("found %d to correct state/lga combinations of %d so far" % (len(d),count)) 79 80 else: 80 msg = "no '%s' for %s" % ( lga_words,student_record.id)81 msg = "no '%s' for %s" % (words,student_record.id) 81 82 logger.info(msg) 82 83 #rwrite(msg) -
WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part2.py
r2997 r3014 62 62 # return (d,states,lgas) 63 63 64 difference = context.waeup_tool.difference64 #difference = context.waeup_tool.difference 65 65 re_split = context.waeup_tool.re_split 66 66 #logger.info('') … … 69 69 logger.info("found %d students" % total) 70 70 count = 0 71 correctable = wrong = 1 71 72 commit_after = 100 72 73 logger.info('started to fix %d records in students_catalog' % total) … … 76 77 words_dict = mapping['word_dict'] 77 78 d = {} 79 not_found_lgas = [] 80 not_found_count = {} 81 rename_lgas = {} 82 rename_lgas['edo_orhionmwon'] = 'edo_ohionmwon' 78 83 for student_record in student_records: 79 84 # skip record without lga value … … 87 92 continue 88 93 #rwrite("%s: %s" % (student_record.id,student_record.lga)) 94 if student_record.lga in rename_lgas.keys(): 95 correctable += 1 96 d[student_record.id] = rename_lgas[student_record.lga] 97 if len(d) and not len(d) % commit_after: 98 logger.info("found %d to correct state/lga combinations of %d so far" % (len(d),count)) 99 continue 89 100 words = student_record.lga 90 101 if len(words.split(' / ')) == 2: 91 102 words = words.replace(' / ',' ') 92 words = re_split('[^a-zA-Z0-9/]',words) 93 lga_words = [] 94 for word in words: 95 if word: 96 lga_words += word.lower(), 97 lga_words.sort() 98 # state = sl[0].lower().strip() 99 # state = '_'.join(state.split()) 100 # lga = sl[1].lower().strip() 101 # if not lga or not state: 102 # logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id)) 103 # continue 104 state_lga = '' 105 while not state_lga: 106 for k,l in words_dict.items(): 107 if lga_words == l: 108 state_lga = k 109 break 110 break 103 state_lga = context.waeup_tool.findLga(words,words_dict) 111 104 if state_lga: 112 105 if state_lga != student_record.lga: 106 correctable += 1 113 107 msg = "found %s is %s for %s " % (state_lga,student_record.lga,student_record.id) 114 108 #rwrite(msg) … … 119 113 msg = "already corrected %s : %s for %s " % (state_lga,student_record.lga,student_record.id) 120 114 else: 121 msg = "no '%s' for %s" % (lga_words,student_record.id) 115 wrong += 1 116 msg = "no '%s' for %s" % (words,student_record.id) 117 if len(words) > 2: 118 if words not in not_found_lgas: 119 not_found_lgas += words, 120 not_found_count[words] = 1 121 else: 122 nfc = not_found_count[words] 123 nfc += 1 124 not_found_count[words] = nfc 125 #rwrite(msg) 122 126 # if count > 2000: 123 127 # break 128 not_found_lgas.sort() 129 for lga in not_found_lgas: 130 msg = "not found %s count: %d" % (lga,not_found_count[lga]) 131 logger.info(msg) 124 132 to_edit = len(d) 125 logger.info("found %d correct state/lga combinations of %d" % (to_edit,count)) 126 133 logger.info("found %d correctable state/lga combinations, not correctable %d total %d" % (correctable, 134 wrong, 135 count)) 127 136 edited = 1 128 137 for student_id,lga in d.items():
Note: See TracChangeset for help on using the changeset viewer.