Changeset 1168 for WAeUP_SRP/trunk


Ignore:
Timestamp:
1 Jan 2007, 16:05:02 (18 years ago)
Author:
joachim
Message:

convert all matric_no to uppercase, check for existing records in catalog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r1151 r1168  
    851851                format_error = format + ',"%(Error)s"'
    852852                no_certificate = "no certificate %s" % format
    853             if student.get('matric_no') == '':
     853            matric_no = student.get('matric_no').upper()
     854            student['matric_no'] = matric_no
     855            if matric_no == '':
    854856                student['Error'] = "Empty matric_no" 
    855857                no_import.append( format_error % student)
    856858                continue
    857             if student.get('matric_no') in regs:
     859            if matric_no in regs or self.returning_import(matric_no = matric_no):
    858860                student['Error'] = "Duplicate" 
    859861                no_import.append( format_error % student)
     
    884886                em = '%d transactions commited total %s\n' % (tr_count,total)
    885887                transaction.commit()
     888                regs = []
    886889                logger.info(em)
    887890                total += tr_count
     
    937940                no_certificate = "no certificate %s" % format
    938941            course_id = result.get('CosCode')
    939             key = result.get('matric_no')+course_id
    940             if key == '':
     942            matric_no = result.get('matric_no').upper()
     943            result['matric_no'] = matric_no
     944            key = matric_no+course_id
     945            if matric_no == '':
    941946                result['Error'] = "Empty matric_no" 
    942947                no_import.append( format_error % result)
    943948                continue
    944             if key in regs:
     949            if key in regs or self.results_import(key = key):
    945950                result['Error'] = "Duplicate" 
    946951                no_import.append( format_error % result)
     
    979984                transaction.commit()
    980985                logger.info(em)
     986                regs = []
    981987                total += tr_count
    982988                tr_count = 0
Note: See TracChangeset for help on using the changeset viewer.