Ignore:
Timestamp:
7 Dec 2007, 13:55:43 (17 years ago)
Author:
joachim
Message:

simplyfied faster display of study_level

File:
1 edited

Legend:

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

    r2855 r2876  
    1212return Info about the Students StudyCourse
    1313"""
     14import DateTime
    1415from Products.AdvancedQuery import Eq, Between, Le,In
    1516
     
    2324    def set_trace():
    2425        pass
     26import logging
     27logger = logging.getLogger('Skins.getStudyCourseInfo')
    2528
    2629request = context.REQUEST
     
    3538course  = info['doc'] = context.getContent()
    3639student_id = context.getStudentId()
    37 res = context.students_catalog(id = student_id)
    38 if not res:
     40student_record = context.students_catalog.getRecordByKey(student_id)
     41if not student_record:
    3942    return None
    40 sbrain = res[0]
    41 info['student'] = sbrain
    42 cert_id = sbrain.course
    43 res = context.portal_catalog_real.evalAdvancedQuery(Eq('id', cert_id) &
    44                                                     Eq('portal_type', "Certificate"))
     43info['student'] = student_record
     44cert_id = student_record.course
     45# logger.info("before search")
     46# starttime = DateTime.DateTime().timeTime()
     47# res = context.portal_catalog_real.evalAdvancedQuery(Eq('id', cert_id)) # &
     48#                                                    Eq('portal_type', "Certificate"))
     49# logger.info("searchtime %f" % (DateTime.DateTime().timeTime() - starttime))
     50# if True:
     51#     #info['cert_id'] = cert_id
     52#     # brain = res[0]
     53#     # ci['title'] = brain.Title
     54#     # pl = brain.getPath().split('/')
     55#     # ci['faculty'] = pl[-4]
     56#     # ci['department'] = pl[-3]
     57#     ci['study_course'] = student_record.course
     58#     ci['faculty'] = student_record.faculty
     59#     ci['department'] = student_record.department
     60#     info['course_doc'] = ci
     61# else:
     62#     info['cert_id'] = 'N/A'
     63#     ci['study_course'] = 'N/A'
     64#     ci['title'] = 'N/A'
     65#     ci['faculty'] = 'N/A'
     66#     ci['department'] = 'N/A'
     67#     info['course_doc'] = ci
    4568ci = {}
    46 if res:
    47     info['cert_id'] = cert_id
    48     brain = res[0]
    49     ci['study_course'] = brain.getId
    50     ci['title'] = brain.Title
    51     pl = brain.getPath().split('/')
    52     ci['faculty'] = pl[-4]
    53     ci['department'] = pl[-3]
    54     info['course_doc'] = ci
    55 else:
    56     info['cert_id'] = 'N/A'
    57     ci['study_course'] = 'N/A'
    58     ci['title'] = 'N/A'
    59     ci['faculty'] = 'N/A'
    60     ci['department'] = 'N/A'
    61     info['course_doc'] = ci
     69ci['study_course'] = student_record.course
     70ci['faculty'] = student_record.faculty
     71ci['department'] = student_record.department
     72info['course_doc'] = ci
    6273
    6374items = []
     
    8293
    8394
    84 current_level = sbrain.level
     95current_level = student_record.level
    8596levels = context.objectIds()
    8697review_state = wftool.getInfoFor(context,'review_state',None)
    87 student_review_state = sbrain.review_state
     98student_review_state = student_record.review_state
    8899#if review_state != 'content_addable' and student_review_state == 'school_fee_paid': #and context.isStudent():
    89100#    wftool.doActionFor(context,'close_for_edit')
     
    95106               (previous_verdict in ('A','B','C','F','J','L','M') or\
    96107               current_level == '100' or\
    97                (sbrain.mode.startswith('de') and current_level == '200'))
     108               (student_record.mode.startswith('de') and current_level == '200'))
    98109
    99110missing_data = has_paid and\
    100111               current_level not in levels and\
    101                not (previous_verdict or sbrain.level) and\
     112               not (previous_verdict or student_record.level) and\
    102113               not (current_level == '100' or\
    103                (sbrain.mode.startswith('de') and current_level == '200'))
     114               (student_record.mode.startswith('de') and current_level == '200'))
    104115
    105116info['missing_data'] = missing_data
Note: See TracChangeset for help on using the changeset viewer.