Ignore:
Timestamp:
27 Jul 2007, 10:17:53 (17 years ago)
Author:
Henrik Bettermann
Message:

resolve ticket #315 number 1 and 2

File:
1 edited

Legend:

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

    r1788 r2067  
    2727                   'courses_validated',
    2828                   )
     29full_time =       ('ume_ft','de_ft','ug_ft','pg_ft')
     30part_time =       (         'de_pt','ug_pt','pg_pt')                   
     31                   
    2932faculties = context.portal_catalog(portal_type="Faculty")
    3033
     
    3740dict['id'] = 'All Faculties'
    3841dict['title'] = 'All Faculties'
    39 res = context.students_catalog(entry_session = entry_sessions)
    40 dict['total'] = len(res)
     42
     43res_ft = context.students_catalog(entry_session = entry_sessions,  mode = full_time)
     44dict['total_ft'] = len(res_ft)
     45
     46res_pt = context.students_catalog(entry_session = entry_sessions,  mode = part_time)
     47dict['total_pt'] = len(res_pt)
     48
    4149for state in ret_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'])
     50    # full_time
     51    res_ft = context.students_catalog(entry_session = entry_sessions, review_state = state,  mode = full_time)
     52    state_ft = state + '_ft'
     53    dict[state_ft] = len(res_ft)
     54    statepercent = state+'_ft_percent'
     55    if dict['total_ft'] > 0:
     56        dict[statepercent] = "%.0f" % round(dict[state_ft]*100.0/dict['total_ft'])
    4757    else:
    4858        dict[statepercent] = 0
     59       
     60    # part_time
     61    res_pt = context.students_catalog(entry_session = entry_sessions, review_state = state,  mode = part_time)
     62    state_pt = state + '_pt'
     63    dict[state_pt] = len(res_pt)
     64    statepercent = state+'_pt_percent'
     65    if dict['total_pt'] > 0:
     66        dict[statepercent] = "%.0f" % round(dict[state_pt]*100.0/dict['total_pt'])
     67    else:
     68        dict[statepercent] = 0       
     69       
    4970l.append(dict)
     71
    5072
    5173for f in faculties:
     
    5375    dict['id'] = f.getId
    5476    dict['title'] = f.Title
    55     res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId)
    56     dict['total'] = len(res)
     77    res_ft = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, mode = full_time)
     78    dict['total_ft'] = len(res_ft)
     79    res_pt = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, mode = part_time)
     80    dict['total_pt'] = len(res_pt)   
    5781    for state in ret_states:
    58         res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, review_state = state)
    59         dict[state] = len(res)
    60         statepercent = state+'_percent'
    61         if dict['total'] > 0:
    62             dict[statepercent] = "%.0f" % round(dict[state]*100.0/dict['total'])
     82        # full_time
     83        res_ft = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, review_state = state, mode = full_time)
     84        state_ft = state + '_ft'
     85        dict[state_ft] = len(res_ft)
     86        statepercent = state+'_ft_percent'
     87        if dict['total_ft'] > 0:
     88            dict[statepercent] = "%.0f" % round(dict[state_ft]*100.0/dict['total_ft'])
    6389        else:
    6490            dict[statepercent] = 0
     91           
     92        # part_time
     93        res_pt = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, review_state = state, mode = part_time)
     94        state_pt = state + '_pt'
     95        dict[state_pt] = len(res_pt)
     96        statepercent = state+'_pt_percent'
     97        if dict['total_pt'] > 0:
     98            dict[statepercent] = "%.0f" % round(dict[state_pt]*100.0/dict['total_pt'])
     99        else:
     100            dict[statepercent] = 0           
     101           
    65102    l.append(dict)
    66103
Note: See TracChangeset for help on using the changeset viewer.