source: WAeUP_SRP/base/skins/waeup_utilities/ti_507_resolve.py @ 3375

Last change on this file since 3375 was 3368, checked in by Henrik Bettermann, 17 years ago

not entry_mode but current_mode (mode) must be checked

  • Property svn:keywords set to Id
File size: 2.3 KB
RevLine 
[3353]1## Script (Python) "ti_507_resolve"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: ti_507_resolve.py 3368 2008-03-21 17:50:50Z henrik $
11"""
12"""
13try:
14    from Products.zdb import set_trace
15except:
16    def set_trace():
17        pass
18
19mtool = context.portal_membership
20member = mtool.getAuthenticatedMember()
21if str(member) not in ('admin','joachim'):
22    return
23
24
25import logging
26import DateTime
27logger = logging.getLogger('Skins.ti_507_resolve')
28from Products.AdvancedQuery import Eq, Between, Le,In
29aq_students = context.students_catalog.evalAdvancedQuery
30aq_portal = context.portal_catalog_real.evalAdvancedQuery
31students_folder = context.portal_url.getPortalObject().campus.students
32
33request = context.REQUEST
34session = request.SESSION
35response = request.RESPONSE
36setheader = request.RESPONSE.setHeader
37logger.info('start')
38count = 0
39found = 0
[3361]40commit_after = 100000
[3353]41certificates = context.getCertificatesDict()
42students = context.students_catalog()
43wrong = []
44missing_courses = []
[3361]45wrong_modes = {}
[3365]46students_with_missing_courses = []
[3353]47for student in students:
48    count += 1
[3368]49    if student.mode and student.course:
[3353]50        certificate = certificates.get(student.course,None)
51        if certificate is None:
[3365]52            students_with_missing_courses += student.id,
[3353]53            if student.course not in missing_courses:
54                missing_courses += student.course,
[3365]55                #logger.info('missing course %s' % student.course)
[3353]56            continue
[3368]57        current_mode = student.mode
[3365]58        study_mode = certificate.get('study_mode','xxx')
[3368]59        if current_mode != study_mode:
60            w_count =  wrong_modes.get((current_mode,study_mode),0)
[3361]61            if w_count == 0:
[3368]62                logger.info('%s != %s' % (student.mode,
[3361]63                                          study_mode))
64            w_count += 1
[3368]65            wrong_modes[(current_mode,study_mode)] = w_count
[3353]66            wrong += student.id,
67    if wrong and not (len(wrong) % commit_after):
68        logger.info('found %d wrong of %d' % (len(wrong),count))
[3361]69for k,v in wrong_modes.items():
70    logger.info('wrong mode %s counted %d' % (k,v))
[3365]71logger.info('missing courses %s (%d counted)' % (', '.join(missing_courses),len(students_with_missing_courses)))
[3353]72logger.info('found %d wrong of %d' % (len(wrong),count))
Note: See TracBrowser for help on using the repository browser.