Changeset 2873 for WAeUP_SRP/base/skins


Ignore:
Timestamp:
7 Dec 2007, 07:32:09 (17 years ago)
Author:
joachim
Message:

fix for #428

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_student/search_students.py

    r2431 r2873  
    1212list Students for ClearanceOfficers
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
    1419import logging
    1520logger = logging.getLogger('Skins.search_students')
     
    6671certificate_levels = fget('certificate_levels')
    6772dep_str = fac_str = certificate_levels_str = ''
    68 
    6973if "ClearanceOfficers" in member.getGroups():
    7074    state = "clearance_requested"
     
    102106    ca_view = True
    103107    if certificate_levels:
    104         #from Products.zdb import set_trace;set_trace()
    105108        certificate_levels_str = certificate_levels
    106109        certificate_levels = certificate_levels.split()
     
    109112                 In('localUsersWithRoles', ("user:%s" % member,))
    110113        res = aq_portal(query)
    111 
    112114        logger.info('CourseAdviser %s initiated student_search' % member)
    113115        certificate_levels = []
    114116        if res:
    115117            certificate_levels = ['/'.join(f.getPath().split('/')[-2:]) for f in res]
     118            cert_ids = []
     119            level_ids = []
     120            for cl in certificate_levels:
     121                c,l = cl.split('/')
     122                level_ids += l,
     123                if c not in cert_ids:
     124                    cert_ids += c,
     125            cert_brains = aq_portal(In("id",cert_ids))
     126            end_levels = {}
     127            for cert_brain in cert_brains:
     128                end_levels[cert_brain.getId] = cert_brain.getObject().getContent().end_level
     129            for cl in certificate_levels[:]:
     130                c,l = cl.split('/')
     131                for prob in (10,20):
     132                    certificate_levels += "%s/%s" % (c,int(l) + prob),
     133                if l == end_levels[c]:
     134                    certificate_levels += "%s/%s" % (c,int(l) + 100),
    116135        user_info['certificate_levels'] = certificate_levels
    117136        certificate_levels_str = " ".join(certificate_levels)
Note: See TracChangeset for help on using the changeset viewer.