Ignore:
Timestamp:
31 Jan 2007, 16:24:18 (18 years ago)
Author:
joachim
Message:

course registration

M waeup_student/student_index.py
M waeup_student/study_level_view.pt
M waeup_student/getStudyLevelInfo.py
M waeup_student/study_course_view.pt
M waeup_student/getStudyCourseInfo.py
AM waeup_academics/getCourseInfo.py

reindex entry_mode

M waeup_utilities/getFromData_entry_mode.py
M waeup_utilities/reindex_entry_mode.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py

    r913 r1380  
    1212return Info about the Studylevel
    1313"""
     14from Products.AdvancedQuery import Eq, Between, Le,In
     15evalAdvancedQuery = context.portal_catalog.evalAdvancedQuery
     16request = context.REQUEST
     17session = request.SESSION
     18response = request.RESPONSE
     19
    1420def calculateGPA():
    1521    """calculate the gpa"""
     
    2935    return 0.0
    3036
    31 request = context.REQUEST
     37def cmp_semester(a,b):
     38    if a['semester'] == b['semester']:
     39        return 0
     40    if a['semester'] > b['semester']:
     41        return 1
     42    return -1
     43
    3244
    3345wf = context.portal_workflow
    3446mtool = context.portal_membership
    35 path_info = request.get('PATH_INFO').split('/')
    36 try:
    37     i = int(path_info[-1])
    38     p = 0
    39 except:
    40     p = 1
     47student_id = context.getStudentId()
     48
    4149info = {}
    42 pt = request.get('PATH_TRANSLATED').split('/')
    43 
    44 student_id = pt[-(3+p)]
    45 level_id = pt[-(1+p)]
    46 info['action'] = "%s" % context.absolute_url()
     50info['student'] = student = context.students_catalog(id=student_id)[0]
    4751info['choosen_ids'] = request.get('ids',[])
    4852info['doc'] = context.getContent()
    49 study_course = context.aq_parent.getContent()
    50 cert_id = study_course.study_course
    51 brain = context.portal_catalog(meta_type="Student",id = student_id)[-1]
    52 cp = brain.getPath()
    53 info['container_path'] = cp
     53##study_course = context.aq_parent.getContent()
     54##cert_id = study_course.study_course
     55cert_id = student.course
    5456info['cert_id'] = cert_id
     57normal = []
     58carry_overs = []
     59for id,obj in context.objectItems():
     60    if id.endswith('_co'):
     61        d = context.getCourseInfo(id[:-3])
     62        d['grade'] = obj.getContent().grade
     63        carry_overs.append(d)
     64    else:
     65        d = context.getCourseInfo(id)
     66        coe = obj.getContent().core_or_elective
     67        d['coe'] = 'Core'
     68        if not coe:
     69            d['coe'] = 'Elective'
     70        normal.append(d)
    5571
    56 res = context.portal_catalog(meta_type="StudentCourseResult",
    57                              container_path="%s/study_course/%s" % (cp,level_id))
    58 first = []
    59 second = []
    60 sum = 0
    61 course_count = 0
    62 for r in res:
    63     row = {}
    64     ro = r.getObject()
    65     rd = ro.getContent()
    66     row['id'] = ro.getId()
    67     row['credits'] = rd.credits
    68     if row['credits'] and rd.grade:
    69         credits = int(rd.credits)
    70         sum += credits * ['F','E','D','C','B','A'].index(rd.grade)
    71         course_count += credits
    72     row['sum'] = sum
    73     row['count'] = course_count
    74     row['title'] = rd.title
    75     #row['core'] = rd.core_or_elective
    76     row['semester'] = rd.semester
    77     row['score'] = rd.score
    78     row['grade'] = rd.grade
    79     row['weight'] = rd.weight
    80     row['url'] = ro.absolute_url()
    81     row['review_state'] = wf.getInfoFor(ro,'review_state','None')
    82     row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
    83     if rd.semester == 1:
    84         first.append(row)
    85     else:
    86         second.append(row)
    87 first.sort()
    88 second.sort()
    89 gpaf = 0.0
    90 if course_count:
    91     gpaf = (float(sum)/course_count)
    92 gpa = "%4.2f" % gpaf
    93 info['doc'].edit(mapping={'gpa': gpaf})
    94 info['first'] = first
    95 info['second'] = second
     72carry_overs.sort(cmp_semester)
     73info['carry_overs'] = carry_overs
     74normal.sort(cmp_semester)
     75info['normal'] = normal
    9676return info
Note: See TracChangeset for help on using the changeset viewer.