Changeset 1112 for WAeUP_SRP/trunk/skins


Ignore:
Timestamp:
21 Dec 2006, 14:01:14 (18 years ago)
Author:
joachim
Message:

statistic enhanced (in custom)

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

Legend:

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

    r1099 r1112  
    2323dep = {}
    2424dep['id'] = "All"
    25 dep['students'] = len(context.students_catalog())
    26 dep['clearance_pin_entered'] = len(aq_portal(Eq('review_state','clearance_pin_entered')))
    27 dep['clearance_requested'] = len(aq_portal(Eq('review_state','clearance_requested')))
    28 dep['cleared_and_validated'] = len(aq_portal(Eq('review_state','cleared_and_validated')))
    29 dep['objection_raised'] = len(aq_portal(Eq('review_state','objection_raised')))
     25total = len(context.students_catalog())
     26dep['students'] = total
     27cpe_res = context.portal_catalog(review_state ='clearance_pin_entered')
     28cpe_ids = [r.getId for r in cpe_res]
     29cpe = len(cpe_res)
     30dep['clearance_pin_entered'] = cpe
     31dep['clearance_pin_entered_percent'] = (cpe*100/total)
     32cr_res = context.portal_catalog(review_state='clearance_requested')
     33cr_ids = [r.getId for r in cr_res]
     34cr = len(cr_res)
     35dep['clearance_requested'] = cr
     36dep['clearance_requested_percent'] = (cr*100/total)
     37cav_res = context.portal_catalog(review_state ='cleared_and_validated')
     38cav_ids = [r.getId for r in cav_res]
     39cav = len(cav_res)
     40dep['cleared_and_validated'] = cav
     41dep['cleared_and_validated_percent'] = (cav*100/total)
     42or_res = context.portal_catalog(review_state='objection_raised')
     43or_ids = [r.getId for r in or_res]
     44ora = len(or_res)
     45dep['objection_raised'] = ora
     46dep['objection_raised_percent'] = (ora*100/total)
    3047l.append(dep)
     48fs = context.portal_catalog(portal_type="Faculty")
     49#from Products.zdb import set_trace;set_trace()
     50for fid in [f.getId for f in fs]:
     51    dep = {}
     52    dep['id'] = fid
     53    fquery = Eq('portal_type','Faculty')
     54    fac_res = context.students_catalog(faculty=fid)
     55    fac_ids = [r.id for r in fac_res]
     56    total = len(fac_res)
     57    dep['students'] = total
     58    cpe = len([s for s in fac_ids if s in cpe_ids])
     59    dep['clearance_pin_entered'] = cpe
     60    dep['clearance_pin_entered_percent'] = 0
     61    if total:
     62        dep['clearance_pin_entered_percent'] = (cpe*100/total)
     63    cr = len([s for s in fac_ids if s in cr_ids])
     64    dep['clearance_requested'] = cr
     65    dep['clearance_requested_percent'] = 0
     66    if total:
     67        dep['clearance_requested_percent'] = (cr*100/total)
     68    cav = len([s for s in fac_ids if s in cav_ids])
     69    dep['cleared_and_validated'] = cav
     70    dep['cleared_and_validated_percent'] = 0
     71    if total:
     72        dep['cleared_and_validated_percent'] = (cav*100/total)
     73    ora = len([s for s in fac_ids if s in or_ids])
     74    dep['objection_raised'] = ora
     75    dep['objection_raised_percent'] = 0
     76    if total:
     77        dep['objection_raised_percent'] = (ora*100/total)
     78    l.append(dep)
    3179return l
    32 
    33 
  • WAeUP_SRP/trunk/skins/waeup_student/statistics_view.pt

    r1099 r1112  
    1717        <table>
    1818          <tr class="odd ajaxtd">
    19             <th >Department</th>
     19            <th >Faculty</th>
    2020            <th align="right">Students</th>
    2121            <th align="right">OR</th>
     
    2626          <tr tal:repeat="d departments"
    2727              tal:attributes="class python:test(repeat['d'].even(), 'even ajaxtd', 'odd ajaxtd')">
    28             <td width="80px"> <span tal:content="d/id" /> </td>
    29             <td width="80px" align="right" tal:content="d/students" />
    30             <td width="80px" align="right" tal:content="d/objection_raised" />
    31             <td width="80px" align="right" tal:content="d/clearance_pin_entered" />
    32             <td width="80px" align="right" tal:content="d/clearance_requested" />
    33             <td width="80px" align="right" tal:content="d/cleared_and_validated" />
     28              <td width="80px"> <span tal:content="d/id" /> </td>
     29              <td width="80px" align="right">
     30                <span tal:content="d/students" />
     31              </td>
     32              <td width="80px" align="right">
     33                <span tal:content="d/objection_raised" />
     34                (<span tal:content="d/objection_raised_percent" />%)
     35              </td>
     36              <td width="80px" align="right">
     37                <span tal:content="d/clearance_pin_entered" />
     38                (<span tal:content="d/clearance_pin_entered_percent" />%)
     39              </td>
     40              <td width="80px" align="right">
     41                <span tal:content="d/clearance_requested" />
     42                (<span tal:content="d/clearance_requested_percent" />%)
     43              </td>
     44              <td width="80px" align="right">
     45                <span tal:content="d/cleared_and_validated" />
     46                (<span tal:content="d/cleared_and_validated_percent" />%)
     47              </td>
    3448          </tr>
    3549        </table>
Note: See TracChangeset for help on using the changeset viewer.