Ignore:
Timestamp:
9 May 2007, 20:05:30 (17 years ago)
Author:
Henrik Bettermann
Message:

new statistics ready

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

Legend:

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

    r1761 r1762  
    2020    return 'Not allowed'
    2121
    22 
    23 total_new = context.students_catalog(session = '06')
     22entry_sessions = ('06')
    2423
    2524new_states =      ('admitted',
     
    4241dict['id'] = 'All Faculties'
    4342dict['title'] = 'All Faculties'
    44 res = context.students_catalog(entry_session = '06')
     43res = context.students_catalog(entry_session = entry_sessions)
    4544dict['total'] = len(res)
    4645for state in new_states:
    47     res = context.students_catalog(entry_session = '06', review_state = state)
     46    res = context.students_catalog(entry_session = entry_sessions, review_state = state)
    4847    dict[state] = len(res)
    49     statepercent = state+'_percent'   
     48    statepercent = state+'_percent'
    5049    if dict['total'] > 0:
    5150        dict[statepercent] = "%.0f" % round(dict[state]*100.0/dict['total'])
    5251    else:
    53         dict[statepercent] = 0   
     52        dict[statepercent] = 0
    5453#fac_res['all'] = dict
    5554l.append(dict)
     
    5958    dict['id'] = f.getId
    6059    dict['title'] = f.Title
    61     res = context.students_catalog(entry_session = '06', faculty = f.getId)
     60    res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId)
    6261    dict['total'] = len(res)
    6362    for state in new_states:
    64         res = context.students_catalog(entry_session = '06', faculty = f.getId, review_state = state)
     63        res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, review_state = state)
    6564        dict[state] = len(res)
    6665        statepercent = state+'_percent'
     
    6867            dict[statepercent] = "%.0f" % round(dict[state]*100.0/dict['total'])
    6968        else:
    70             dict[statepercent] = 0   
     69            dict[statepercent] = 0
    7170    #fac_res[f.getId] = dict
    7271    l.append(dict)
  • WAeUP_SRP/trunk/skins/waeup_student/getRetStudentStatistics.py

    r1571 r1762  
    1 ## Script (Python) "getRetStudentStatistics"
     1## Script (Python) "getNewStudentStatistics"
    22##bind container=container
    33##bind context=context
     
    1212return Student Statistics
    1313"""
     14
    1415import logging
    1516logger = logging.getLogger('Skins.getRetStudentStatistics')
    1617
    17 try:
    18     from Products.AdvancedQuery import Eq, Between, Le,In, Ge
    19     aq_portal = context.portal_catalog.evalAdvancedQuery
    20     aq_students = context.students_catalog.evalAdvancedQuery
    21 except:
    22     evalAdvancedQuery = None
    2318logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember())
     19if not context.isStaff():
     20    return 'Not allowed'
     21
     22entry_sessions = ('98','99','00','01','02','03','04','05')
     23
     24new_states =      ('returning',
     25                   'school_fee_paid',
     26                   'courses_registered',
     27                   'courses_validated',
     28                   )
     29faculties = context.portal_catalog(portal_type="Faculty")
     30
    2431l = []
    25 if not context.isStaff():
    26     return l
    27 dep = {}
    28 dep['id'] = "All Faculties"
    2932
    3033
    31 ret_res1 = context.portal_catalog(review_state = 'returning')
    32 ret_ids1 = [r.getId for r in ret_res1]
    33 total_ret = len(ret_ids1)
     34fac_res = {}
    3435
    35 ret_res2 = context.portal_catalog(review_state = ('school_fee_paid','courses_registered','courses_validated',))
    36 ret_ids2 = [r.getId for r in ret_res2]
     36dict = {}
     37dict['id'] = 'All Faculties'
     38dict['title'] = 'All Faculties'
     39res = context.students_catalog(entry_session = entry_sessions)
     40dict['total'] = len(res)
     41for state in new_states:
     42    res = context.students_catalog(entry_session = entry_sessions, review_state = state)
     43    dict[state] = len(res)
     44    statepercent = state+'_percent'
     45    if dict['total'] > 0:
     46        dict[statepercent] = "%.0f" % round(dict[state]*100.0/dict['total'])
     47    else:
     48        dict[statepercent] = 0
     49#fac_res['all'] = dict
     50l.append(dict)
    3751
    38 retquery = Ge('level','300') | (Eq('level','200') & Eq('entry_mode','UME'))
    39 ret_res3 = aq_students(retquery)
    40 ret_ids3 = [r.id for r in ret_res3]
    41 
    42 l.append(dep)
    43 sum_ret = 0
    44 sum_sfp = 0
    45 fs = context.portal_catalog(portal_type="Faculty")
    46 for fid in [f.getId for f in fs]:
    47     dep = {}
    48     dep['id'] = fid
    49     fquery = Eq('faculty',fid)
    50     stud_res = aq_students(fquery)
    51     stud_ids = [r.id for r in stud_res]
    52     total = float(len(stud_res))
    53     if total == 0:
    54         continue
    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 
    62     l.append(dep)
    63 
    64 l[0]['ret'] = sum_ret
    65 l[0]['sfp'] = sum_sfp
    66 l[0]['total_ret'] = total_ret + sum_sfp
    67 l[0]['total_li'] = sum_ret + sum_sfp
    68 
     52for f in faculties:
     53    dict = {}
     54    dict['id'] = f.getId
     55    dict['title'] = f.Title
     56    res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId)
     57    dict['total'] = len(res)
     58    for state in new_states:
     59        res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, review_state = state)
     60        dict[state] = len(res)
     61        statepercent = state+'_percent'
     62        if dict['total'] > 0:
     63            dict[statepercent] = "%.0f" % round(dict[state]*100.0/dict['total'])
     64        else:
     65            dict[statepercent] = 0
     66    #fac_res[f.getId] = dict
     67    l.append(dict)
    6968
    7069return l
    7170
     71
  • WAeUP_SRP/trunk/skins/waeup_student/search_students_form.pt

    r1582 r1762  
    1818      <nobr><a href="statistics_ret_view">Returning Student Statistics</a>
    1919      &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
    20       <nobr><a href="statistics_reg_view">Registration Statistics</a>
    21       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>       
    2220      <nobr><a href="list_students">Cleared Student Export</a>
    2321      &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
  • WAeUP_SRP/trunk/skins/waeup_student/statistics_new_view.pt

    r1761 r1762  
    1111 
    1212      <strong>
    13       <nobr><a href="statistics_new_view">New Student Statistics</a>
    14       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
     13      <nobr><a href="search_students">Search Students</a>
     14      &nbsp;&nbsp;&nbsp;&nbsp;</nobr>     
    1515      <nobr><a href="statistics_ret_view">Returning Student Statistics</a>
    16       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
    17       <nobr><a href="statistics_reg_view">Registration Statistics</a>
    18       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>       
    19       <nobr><a href="list_students">Cleared Student Export</a>
    2016      &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
    2117      </strong>     
  • WAeUP_SRP/trunk/skins/waeup_student/statistics_ret_view.pt

    r1621 r1762  
    11<metal:body use-macro="here/main_template/macros/master">
    22  <metal:main fill-slot="main">
    3   <metal:block tal:define="departments context/getRetStudentStatistics;
     3  <metal:block tal:define="faculties context/getRetStudentStatistics;
    44                        mtool here/portal_membership;
    55                        member mtool/getAuthenticatedMember;">       
    66
    7       <span tal:condition="not: departments">
     7      <span tal:condition="not: faculties">
    88        <span tal:content="here/illegal_view" />
    99      </span>
    10       <span tal:condition="departments">
     10      <span tal:condition="faculties">
    1111 
    1212      <strong>
     13      <nobr><a href="search_students">Search Students</a>
     14      &nbsp;&nbsp;&nbsp;&nbsp;</nobr>       
    1315      <nobr><a href="statistics_new_view">New Student Statistics</a>
    1416      &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
    15       <nobr><a href="statistics_ret_view">Returning Student Statistics</a>
    16       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
    17       <nobr><a href="statistics_reg_view">Registration Statistics</a>
    18       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>       
    19       <nobr><a href="list_students">Cleared Student Export</a>
    20       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
    21       </strong>
     17      </strong>     
    2218
    23    
    24       <h3>Returning Student Statistics</h3>
     19      <h3>New Student Statistics</h3>
    2520      <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 />
    3121      <span tal:condition="not:isAnon">
    3222        <table>
    3323          <tr class="odd ajaxtd">
    3424            <th >Faculty</th>
     25            <th align="right">Total</th>
    3526            <th align="right">RET</th>
    36             <th align="right">SFP+</th>
     27            <th align="right">SFP</th>
     28            <th align="right">CR</th>
     29            <th align="right">CV</th>
     30
    3731          </tr>
    38           <tr tal:define="d python:departments[0]"
    39               class="even ajaxtd">
    40               <td width="80px">All Faculties</td>
     32          <tr tal:repeat="d faculties"
     33              tal:attributes="class python:test(repeat['d'].even(), 'even ajaxtd', 'odd ajaxtd')">
     34              <td width="80px"> <span tal:content="d/id" /> </td>
     35              <td width="80px" align="right">
     36                <span tal:content="d/total" />
     37              </td>
    4138              <td width="80px" align="right">
    42                 <span tal:content="d/ret" />
    43               </td>   
     39                <span tal:content="d/returning" />
     40                (<span tal:content="d/returning_percent" />%)
     41              </td>             
    4442              <td width="80px" align="right">
    45                 <span tal:content="d/sfp" />
    46               </td>             
    47           </tr>
    48           <tr tal:repeat="d python:departments[1:]"
    49               tal:attributes="class python:test(repeat['d'].even(), 'odd ajaxtd', 'even ajaxtd')">
    50               <td width="80px"> <span tal:content="d/id" /> </td>
     43                <span tal:content="d/school_fee_paid" />
     44                (<span tal:content="d/school_fee_paid_percent" />%)
     45              </td>
    5146              <td width="80px" align="right">
    52                 <span tal:content="d/ret" />
    53               </td>       
     47                <span tal:content="d/courses_registered" />
     48                (<span tal:content="d/courses_registered_percent" />%)
     49              </td>
    5450              <td width="80px" align="right">
    55                 <span tal:content="d/sfp" />
    56               </td>                             
     51                <span tal:content="d/courses_validated" />
     52                (<span tal:content="d/courses_validated_percent" />%)
     53              </td>                                         
     54
    5755          </tr>
    5856        </table>
    5957        <br />
    6058        <table>
    61         <tr><td>RET:</td> <td>Returning students who have logged in</td></tr>
    62         <tr><td>SFP:</td> <td>Returning students who paid their school fee</td></tr>
    63         </table>       
     59        <tr><td>RET: </td> <td>Returning</td></tr>
     60        <tr><td>SFP: </td> <td>School fee paid</td></tr>
     61        <tr><td>CR: </td> <td>Course list registered</td></tr>
     62        <tr><td>CV: </td> <td>Course list validated</td></tr>               
     63        </table>
    6464      </span>
    6565      </span>
Note: See TracChangeset for help on using the changeset viewer.