source: WAeUP_SRP/base/skins/waeup_statistics/getSimpleStudentStatistics.py @ 2809

Last change on this file since 2809 was 2707, checked in by Henrik Bettermann, 17 years ago

total numbers changed

File size: 4.8 KB
RevLine 
[2243]1## Script (Python) "getRetStudentStatistics"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: getStudentStatistics.py 1277 2007-01-11 21:11:37Z joachim $
11"""
12return Student Statistics
13"""
14
15import logging
16logger = logging.getLogger('Skins.getSimpleStudentStatistics')
17
18logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember())
19if not context.isStaff():
[2431]20    return
[2243]21
22
23catA =      (      'school_fee_paid',
24                   'courses_registered',
25                   'courses_validated',
26                   )
27
28catB =      (      'courses_registered',
29                   'courses_validated',
30                   )
31
[2705]32catC =      (      'student_created',
33                   'returning',
[2243]34                   'admitted',
35                   'clearance_pin_entered',
36                   'objection_raised',
37                   'clearance_requested',
38                   'cleared_and_validated',
39                   )
40
[2705]41current_session = context.getSessionId()[0]
[2243]42
[2705]43
[2243]44full_time =       ('ume_ft','de_ft','ug_ft','pg_ft')
45part_time =       (         'de_pt','ug_pt','pg_pt')
46diploma   =       ('dp_ft','dp_pt')
47
48
49faculties = context.portal_catalog(portal_type="Faculty")
50
51l = []
52
53fac_res = {}
54
55dict = {}
56dict['id'] = 'All Faculties'
57dict['title'] = 'All Faculties'
58
59
60res_ft = context.students_catalog(mode = full_time)
61dict['total_ft'] = len(res_ft)
62
63res_pt = context.students_catalog(mode = part_time)
64dict['total_pt'] = len(res_pt)
65
66res_dp = context.students_catalog(mode = diploma)
67dict['total_dp'] = len(res_dp)
68
[2705]69res_Aft = context.students_catalog(review_state = catA, mode = full_time, session = current_session)
[2243]70dict['total_Aft'] = len(res_Aft)
71
[2705]72res_Apt = context.students_catalog(review_state = catA, mode = part_time, session = current_session)
[2243]73dict['total_Apt'] = len(res_Apt)
74
[2705]75res_Adp = context.students_catalog(review_state = catA, mode = diploma, session = current_session)
[2243]76dict['total_Adp'] = len(res_Adp)
77
[2705]78res_Bft = context.students_catalog(review_state = catB, mode = full_time, session = current_session)
[2243]79dict['total_Bft'] = len(res_Bft)
80
[2705]81res_Bpt = context.students_catalog(review_state = catB, mode = part_time, session = current_session)
[2243]82dict['total_Bpt'] = len(res_Bpt)
83
[2705]84res_Bdp = context.students_catalog(review_state = catB, mode = diploma, session = current_session)
[2243]85dict['total_Bdp'] = len(res_Bpt)
86
[2707]87res_Cft = context.students_catalog(review_state = catC, mode = full_time, session = current_session)
[2243]88dict['total_Cft'] = len(res_Cft)
89
[2707]90res_Cpt = context.students_catalog(review_state = catC, mode = part_time, session = current_session)
[2243]91dict['total_Cpt'] = len(res_Cpt)
92
[2707]93res_Cdp = context.students_catalog(review_state = catC, mode = diploma, session = current_session)
[2243]94dict['total_Cdp'] = len(res_Cdp)
95
96
97res_total = context.students_catalog()
98dict['total_in_catalog'] = len(res_total)
[2707]99dict['not_categorized'] = dict['total_in_catalog'] - dict['total_ft'] - dict['total_pt'] - dict['total_dp']
[2243]100
101l.append(dict)
102
103
104for f in faculties:
105    dict = {}
106    dict['id'] = f.getId
107    dict['title'] = f.Title
108
109    res_ft = context.students_catalog(faculty = f.getId, mode = full_time)
110    dict['total_ft'] = len(res_ft)
111
112    res_pt = context.students_catalog(faculty = f.getId, mode = part_time)
113    dict['total_pt'] = len(res_pt)
114
115    res_dp = context.students_catalog(faculty = f.getId, mode = diploma)
116    dict['total_dp'] = len(res_dp)
117
[2705]118    res_Aft = context.students_catalog(faculty = f.getId, review_state = catA, mode = full_time, session = current_session)
[2243]119    dict['total_Aft'] = len(res_Aft)
120
[2705]121    res_Apt = context.students_catalog(faculty = f.getId, review_state = catA, mode = part_time, session = current_session)
[2243]122    dict['total_Apt'] = len(res_Apt)
123
[2705]124    res_Adp = context.students_catalog(faculty = f.getId, review_state = catA, mode = diploma, session = current_session)
[2243]125    dict['total_Adp'] = len(res_Adp)
126
[2705]127    res_Bft = context.students_catalog(faculty = f.getId, review_state = catB, mode = full_time, session = current_session)
[2243]128    dict['total_Bft'] = len(res_Bft)
129
[2705]130    res_Bpt = context.students_catalog(faculty = f.getId, review_state = catB, mode = part_time, session = current_session)
[2243]131    dict['total_Bpt'] = len(res_Bpt)
132
[2705]133    res_Bdp = context.students_catalog(faculty = f.getId, review_state = catB, mode = diploma, session = current_session)
[2243]134    dict['total_Bdp'] = len(res_Bpt)
135
[2707]136    res_Cft = context.students_catalog(faculty = f.getId, review_state = catC, mode = full_time, session = current_session)
[2243]137    dict['total_Cft'] = len(res_Cft)
138
[2707]139    res_Cpt = context.students_catalog(faculty = f.getId, review_state = catC, mode = part_time, session = current_session)
[2243]140    dict['total_Cpt'] = len(res_Cpt)
141
[2707]142    res_Cdp = context.students_catalog(faculty = f.getId, review_state = catC, mode = diploma, session = current_session)
[2243]143    dict['total_Cdp'] = len(res_Cdp)
144
145
146    l.append(dict)
147
148return l
149
150
Note: See TracBrowser for help on using the repository browser.