source: WAeUP_SRP/trunk/skins/waeup_utilities/ti_188_resolve.py @ 1680

Last change on this file since 1680 was 1680, checked in by joachim, 18 years ago

fix for #188 remove comments in lin 84,86 for real changes

  • Property svn:keywords set to Id
File size: 3.1 KB
RevLine 
[1680]1## Script (Python) "search_pins"
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_188_resolve.py 1680 2007-04-11 13:49:34Z joachim $
11"""
12resolve ticket #188
13"""
14
15request = context.REQUEST
16session = request.SESSION
17response = request.RESPONSE
18setheader = request.RESPONSE.setHeader
19
20def getObject(outer,object):
21    if outer and outer.hasObject(object):
22        return getattr(outer,object)
23    return None
24
25def rwrite(s):
26    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
27    response.write("%s<br>\n\r" % s)
28
29wftool = context.portal_workflow
30mtool = context.portal_membership
31member = mtool.getAuthenticatedMember()
32roles = member.getRolesInContext(context)
33retcat = context.returning_import
34rcat = context.results_import
35scat = context.students_catalog
36from Products.AdvancedQuery import Eq, Between, Le,In
37aq_students = context.students_catalog.evalAdvancedQuery
38students = context.portal_url.getPortalObject().campus.students
39
40
41if str(member) not in ('admin','joachim'):
42    return
43count = 0
44ok_count = 0
45nyl_count = 0
46wrong_count = 0
47cr_count = 0
48res = scat()
49for sbrain in res:
50    if str(sbrain.level) == '100':
51        ec = "new"
52    else:
53        ec = "nor"
54    erg = context.results_import(matric_no=sbrain.matric_no)
55    if erg and erg[0].Level:
56        level_res = erg[0].Level
57        everdict = erg[0].Verdict
58        level_cc = context.getLevelFromResultsCosCode(erg)
59        #if level_cc == 0:
60            #lc = "-"
61        lc = "%s00" % level_cc
62        verdict,elegible = context.getVerdict(everdict)
63        if elegible:
64            continue
65        dict = context.getFormattedStudentEntry(sbrain)
66        dict['level_res'] = lc
67        count += 1
68        dict['count'] = count
69        code = 'xxx'
70        comment = ""
71        if sbrain.level == '':
72            code = 'nyl'
73            nyl_count += 1
74        elif sbrain.level != lc:
75            code = 'nok'
76            wrong_count += 1
77            student = getObject(students,sbrain.id)
78            study_course = getObject(student,'study_course')
79            level = getObject(study_course,sbrain.level)
80            if level is not None:
81                code = 'nok_cr'
82                cr_count += 1
83                comment = "%(level)s deleted" % dict
84                ##study_course.manage_delObjects((sbrain.level,))
85            comment = comment + " level in students_catalog modified to %s" % lc
86            ##context.students_catalog.modifyRecord(id = sbrain.id,level=lc,)
87        else:
88            ok_count += 1
89            code = 'ok'
90        dict['nyl_count'] = nyl_count
91        dict['ok_count'] = ok_count
92        dict['cr_count'] = cr_count
93        dict['wrong_count'] = wrong_count
94        dict['code'] = code
95        dict['comment'] = comment
96        rwrite('"%(count)d:%(ok_count)d:%(nyl_count)d:%(wrong_count)d:%(cr_count)d","%(code)s","%(id)s","%(name)s","%(level)s","%(level_res)s","%(comment)s"' % dict)
97
98rwrite("total: %(count)d<br> correct: %(ok_count)d<br> level == '': %(nyl_count)d<br> wrong: %(wrong_count)d<br> level created: %(cr_count)d" % dict )
Note: See TracBrowser for help on using the repository browser.