Changeset 1260 for WAeUP_SRP/trunk/skins/waeup_utilities
- Timestamp:
- 10 Jan 2007, 23:18:11 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_utilities/createReturningStudent.py
r1258 r1260 33 33 return "Student MatricNo %s, StudentId %s Jamb %s created" % (matric_no,sid,jamb_reg_no) 34 34 35 students = context.returning_import(emil="adf")35 matric_nos = context.returning_import.uniqueValuesFor('matric_no') 36 36 count = 1 37 37 total = 0 38 38 logger.info('"%s","Create Students start"' % (member)) 39 #from Products.zdb import set_trace;set_trace() 40 for student in students: 41 if context.students_catalog(matric_no=student.matric_no): 42 logger.info('"Student already exists","%s"' % (student.matric_no)) 39 letters = ('ABCDEFGHKLMNPQRSTUVWXYZ') 40 lc = 0 41 for matric_no in matric_nos: 42 res = context.students_catalog(matric_no = matric_no) 43 if len(res) == 1: 44 #logger.info('"Student already exists","%s"' % (matric_no)) 43 45 continue 44 if count > 100: 45 context.waeup_tool.createOne(students_folder,student,'Z',commit=True) 46 elif len(res) > 1: 47 logger.info('"Student with multiple entries","%s","%s" ' % (matric_no,len(res))) 48 ids = [r.id for r in res if not r.id.startswith('A')] 49 #from Products.zdb import set_trace;set_trace() 50 for id in ids: 51 context.students_catalog.deleteRecord(id) 52 students_folder.manage_delObjects(ids) 53 logger.info('"deleted students","%s" ' % " ".join(ids)) 54 continue 55 student = context.returning_import(matric_no=matric_no)[0] 56 letter = letters[lc] 57 lc += 1 58 if lc == len(letters): 59 lc = 0 60 context.waeup_tool.createOne(students_folder,student,letter) 61 logger.info('"Student created","%s"' % (matric_no)) 62 count += 1 63 if count > 10: 46 64 logger.info('"%s","Committed Students","%s", "%s" ' % (member,count,total)) 47 65 total += count 48 66 count = 1 49 if total > 500:50 break51 else:52 for letter in ('ABCDEFGHKLMNPQRSTUVWXY'):53 context.waeup_tool.createOne(students_folder,student,letter)54 count += 155 67 logger.info('"%s","Create Students finish","%s"' % (member,total))
Note: See TracChangeset for help on using the changeset viewer.