Changeset 1551


Ignore:
Timestamp:
15 Mar 2007, 11:07:15 (18 years ago)
Author:
Henrik Bettermann
Message:

ticket 114

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

Legend:

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

    r1536 r1551  
    1313"""
    1414import logging
    15 logger = logging.getLogger('Student.Statistics')
     15logger = logging.getLogger('Skins.getRetStudentStatistics')
    1616
    1717try:
     
    2121except:
    2222    evalAdvancedQuery = None
    23 logger.info('"%s","invoked returning statistics"' % context.portal_membership.getAuthenticatedMember())
     23logger.info('%s invoked returning statistics' % context.portal_membership.getAuthenticatedMember())
    2424l = []
    2525if not context.isStaff():
    2626    return l
    2727dep = {}
    28 sum = 0
    2928dep['id'] = "All Faculties"
    3029
    31 #from Products.zdb import set_trace;set_trace()
    3230
    33 ret_res = context.portal_catalog(review_state ='returning')
    34 ret_ids = [r.getId for r in ret_res]
    35 ret = len(ret_res)
    36 dep['total'] = ret
     31ret_res1 = context.portal_catalog(review_state = 'returning')
     32ret_ids1 = [r.getId for r in ret_res1]
     33total_ret = len(ret_ids1)
     34
     35ret_res2 = context.portal_catalog(review_state = ('school_fee_paid','courses_registered','courses_validated',))
     36ret_ids2 = [r.getId for r in ret_res2]
     37
     38retquery = Ge('level','300') | (Eq('level','200') & Eq('entry_mode','UME'))
     39ret_res3 = aq_students(retquery)
     40ret_ids3 = [r.id for r in ret_res3]
    3741
    3842l.append(dep)
     43sum_ret = 0
     44sum_sfp = 0
    3945fs = context.portal_catalog(portal_type="Faculty")
    4046for fid in [f.getId for f in fs]:
     
    4551    stud_ids = [r.id for r in stud_res]
    4652    total = float(len(stud_res))
    47 
    4853    if total == 0:
    4954        continue
    50 
    51     ret = len([s for s in stud_ids if s in ret_ids])
    52     dep['returned'] = ret
    53     sum += ret
    54 
    55     if ret == 0:
    56         continue
    57 
     55    sfp = len([s for s in stud_ids if s in ret_ids2 and s in ret_ids3])
     56    dep['sfp'] = sfp
     57    ret = len([s for s in stud_ids if s in ret_ids1])
     58    dep['ret'] = ret
     59    sum_ret += ret
     60    sum_sfp += sfp
     61       
    5862    l.append(dep)
    5963
    60 l[0]['sum'] = sum
     64l[0]['ret'] = sum_ret
     65l[0]['sfp'] = sum_sfp
     66l[0]['total_ret'] = total_ret + sum_sfp
     67l[0]['total_li'] = sum_ret + sum_sfp
     68
    6169
    6270return l
  • WAeUP_SRP/trunk/skins/waeup_student/statistics_ret_view.pt

    r1532 r1551  
    2424      <h3>Returning Student Statistics</h3>
    2525      <br />     
     26      <span tal:content="python:departments[0]['total_ret']" />
     27      returning student records have been imported.
     28      <span tal:content="python:departments[0]['total_li']" /> returning students
     29      have logged in.
     30      <br /><br />
    2631      <span tal:condition="not:isAnon">
    2732        <table>
    2833          <tr class="odd ajaxtd">
    2934            <th >Faculty</th>
    30             <th align="right">Returning</th>
     35            <th align="right">RET</th>
     36            <th align="right">SFP</th>
    3137          </tr>
    3238          <tr tal:define="d python:departments[0]"
     
    3440              <td width="80px">All Faculties</td>
    3541              <td width="80px" align="right">
    36                 <span tal:content="d/sum" /> of <span tal:content="d/total" />
     42                <span tal:content="d/ret" />
     43              </td>   
     44              <td width="80px" align="right">
     45                <span tal:content="d/sfp" />
    3746              </td>             
    3847          </tr>
     
    4150              <td width="80px"> <span tal:content="d/id" /> </td>
    4251              <td width="80px" align="right">
    43                 <span tal:content="d/returned " />
    44               </td>             
     52                <span tal:content="d/ret" />
     53              </td>       
     54              <td width="80px" align="right">
     55                <span tal:content="d/sfp" />
     56              </td>                             
    4557          </tr>
    4658        </table>
    4759        <br />
     60        <table>
     61        <tr><td>RET:</td> <td>Returning students who only logged in</td></tr>
     62        <tr><td>SFP:</td> <td>Returning students who paid their school fee</td></tr>
     63        </table>       
    4864      </span>
    4965      </span>
Note: See TracChangeset for help on using the changeset viewer.