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

Last change on this file since 3356 was 3353, checked in by joachim, 17 years ago

first version to checkfor wrong entry_modes,
with my uniben data.fs results in:

2008-03-19 09:28:43 INFO Skins.ti_507_resolve start
2008-03-19 09:28:47 INFO Skins.ti_507_resolve ume_ft != ug_ft
2008-03-19 09:28:48 INFO Skins.ti_507_resolve dp_ft != ct_ft
2008-03-19 09:28:48 INFO Skins.ti_507_resolve de_ft != ug_ft
2008-03-19 09:28:50 INFO Skins.ti_507_resolve missing course MISC
2008-03-19 09:28:51 INFO Skins.ti_507_resolve ug_pt != ug_ft
2008-03-19 09:28:52 INFO Skins.ti_507_resolve dp_pt != dp_ft
2008-03-19 09:29:06 INFO Skins.ti_507_resolve unknown != dp_pt
2008-03-19 09:29:08 INFO Skins.ti_507_resolve found 10000 wrong of 17378
2008-03-19 09:29:30 INFO Skins.ti_507_resolve found 20000 wrong of 36497
2008-03-19 09:29:46 INFO Skins.ti_507_resolve found 30000 wrong of 49638
2008-03-19 09:29:58 INFO Skins.ti_507_resolve wrong modes ume_ft, dp_ft, de_ft, ug_pt, dp_pt, unknown
2008-03-19 09:29:58 INFO Skins.ti_507_resolve missing courses MISC
2008-03-19 09:29:58 INFO Skins.ti_507_resolve found 35763 wrong of 60101

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
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 3353 2008-03-19 08:35:45Z joachim $
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
40commit_after = 10000
41certificates = context.getCertificatesDict()
42students = context.students_catalog()
43wrong = []
44missing_courses = []
45wrong_modes = []
46for student in students:
47    count += 1
48    if student.entry_mode and student.course:
49        certificate = certificates.get(student.course,None)
50        if certificate is None:
51            if student.course not in missing_courses:
52                missing_courses += student.course,
53                logger.info('missing course %s' % student.course)
54            continue
55        entry_mode = student.entry_mode   
56        if entry_mode != certificate.get('study_mode','xxx'):
57            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']))
62    if wrong and not (len(wrong) % commit_after):
63        logger.info('found %d wrong of %d' % (len(wrong),count))
64       
65logger.info('wrong modes %s' % (', '.join(wrong_modes)))
66logger.info('missing courses %s' % (', '.join(missing_courses)))
67logger.info('found %d wrong of %d' % (len(wrong),count))
Note: See TracBrowser for help on using the repository browser.