Ignore:
Timestamp:
20 Mar 2008, 09:19:20 (17 years ago)
Author:
joachim
Message:

improve logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_utilities/ti_507_resolve.py

    r3353 r3361  
    3838count = 0
    3939found = 0
    40 commit_after = 10000
     40commit_after = 100000
    4141certificates = context.getCertificatesDict()
    4242students = context.students_catalog()
    4343wrong = []
    4444missing_courses = []
    45 wrong_modes = []
     45wrong_modes = {}
    4646for student in students:
    4747    count += 1
     
    5353                logger.info('missing course %s' % student.course)
    5454            continue
    55         entry_mode = student.entry_mode   
    56         if entry_mode != certificate.get('study_mode','xxx'):
     55        entry_mode = student.entry_mode
     56        study_mode = certificate.get('study_mode','xxx')
     57        if entry_mode != study_mode:
     58            w_count =  wrong_modes.get((entry_mode,study_mode),0)
     59            if w_count == 0:
     60                logger.info('%s != %s' % (student.entry_mode,
     61                                          study_mode))
     62            w_count += 1
     63            wrong_modes[(entry_mode,study_mode)] = w_count
    5764            wrong += student.id,
    58             if student.entry_mode not in wrong_modes:
    59                 wrong_modes += student.entry_mode,
    60                 logger.info('%s != %s' % (student.entry_mode,
    61                                           certificates[student.course]['study_mode']))
    6265    if wrong and not (len(wrong) % commit_after):
    6366        logger.info('found %d wrong of %d' % (len(wrong),count))
    64        
    65 logger.info('wrong modes %s' % (', '.join(wrong_modes)))
     67for k,v in wrong_modes.items():
     68    logger.info('wrong mode %s counted %d' % (k,v))
    6669logger.info('missing courses %s' % (', '.join(missing_courses)))
    6770logger.info('found %d wrong of %d' % (len(wrong),count))
Note: See TracChangeset for help on using the changeset viewer.