Changeset 1165 for WAeUP_SRP


Ignore:
Timestamp:
31 Dec 2006, 16:27:38 (18 years ago)
Author:
joachim
Message:

group results by semester,
show titles for courses, for that the courses_catalog must be available.

Location:
WAeUP_SRP/trunk/skins/waeup_student
Files:
2 edited

Legend:

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

    r1151 r1165  
    4040                                 )
    4141elif psm == 'valid':
    42 ##    context.waeup_tool.makeStudent(ds.get('student'),
    43 ##                                   results=ds.get('results'))
    44     return context.session_results_anon_view(student=ds.get('student'),
    45                                            results=ds.get('results'))
     42    pass
     43brains = ds.get('results')
     44sem1 = []
     45sem2 = []
     46with_courses_cat = hasattr(context,'courses_catalog')
     47fields = context.results_import.schema()
     48for r in brains:
     49    result = {}
     50    for field in fields:
     51        result[field] = getattr(r,field)
     52    if with_courses_cat:
     53        res = context.courses_catalog(code = r.CosCode)
     54    if with_courses_cat and res:
     55        result['title'] = res[0].title
     56    else:
     57        result['title'] = "Title no available"
     58    if r.Semester == '2':
     59        sem2.append(result)
     60    else:
     61        sem1.append(result)
     62#from Products.zdb import set_trace;set_trace()
     63results = (sem1, sem2)
     64return context.session_results_anon_view(student=ds.get('student'),
     65                                           results=results)
    4666
  • WAeUP_SRP/trunk/skins/waeup_student/session_results_anon_view.pt

    r1160 r1165  
    44  <metal:body use-macro="here/main_template/macros/master">
    55    <metal:main fill-slot="main">
    6       <div style="text-align: right">
     6      <div tal:condition="nothing" style="text-align: right">
    77        <a href="" target="slip" tal:attributes="href string:session_results_anon_slip?nr=${student/matric_no}"
    88           onclick="javascript:window.open('','slip','width=600, height=700, directories=no, toolbar=no, location=no, menubar=yes, scrollbars=yes, status=no, resizable=no, dependent=no')">
     
    3333       <table>
    3434          <tr>
    35             <th width="150px">Verdict:</th><td tal:content="python:results[0]['Verdict']" />
     35            <th width="150px">Verdict:</th><td tal:content="python:results[0][0]['Verdict']" />
    3636          </tr>
    3737          <tr> 
    38             <th>Session:</th><td tal:content="python:results[0]['Session']" />
     38            <th>Session:</th><td tal:content="python:results[0][0]['Session']" />
    3939          </tr>       
    4040       </table>
     
    4343                     
    4444       <table>
    45         <span tal:repeat="result results">
    46           <tr tal:condition="repeat/result/start">
    47             <th width="150px">Course</th><th>Grade</th>
     45         <span tal:repeat="semester results">
     46          <tr tal:condition="repeat/semester/start">
     47            <th width="50px">Course</th><th>Title</th><th>Grade</th>
    4848          </tr>
    49           <tr><td tal:content="result/CosCode" />
    50             <td tal:content="result/GRADE" />
     49            <span tal:repeat="result semester">
     50             <tr tal:condition="repeat/result/start">
     51              <th colspan="5">
     52                <span tal:replace="python: test(repeat['result'].index,'Second','First')" /> Semester
     53              </th>
     54             </tr>
     55            <tr>     
     56            <td tal:content="result/CosCode" />
     57            <td tal:condition="nothing" align="center" tal:content="result/Semester" />
     58            <td tal:content="result/title" />
     59            <td align="center" tal:content="result/GRADE" />
    5160          </tr>
     61        </span>
    5262        </span>
    5363      </table>
Note: See TracChangeset for help on using the changeset viewer.