source: WAeUP_SRP/trunk/skins/waeup_student/getSimpleStudentStatistics.py @ 2087

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

see ticket #315 (not yet tested)

File size: 4.4 KB
Line 
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():
20    return 'Not allowed'
21
22#entry_sessions = ('-1','94','95','96','97','98','99','00','01','02','03','04','05','0','1','2','3','4','5')
23
24catA =      (      'school_fee_paid',
25                   'courses_registered',
26                   'courses_validated',
27                   )
28
29catB =      (      'courses_registered',
30                   'courses_validated',
31                   )
32
33catC =      ('admitted',
34                   'clearance_pin_entered',
35                   'objection_raised',
36                   'clearance_requested',
37                   'cleared_and_validated',
38                   )
39
40
41full_time =       ('ume_ft','de_ft','ug_ft','pg_ft')
42part_time =       (         'de_pt','ug_pt','pg_pt')
43diploma   =       ('dp_ft','dp_pt')
44
45
46faculties = context.portal_catalog(portal_type="Faculty")
47
48l = []
49
50fac_res = {}
51
52dict = {}
53dict['id'] = 'All Faculties'
54dict['title'] = 'All Faculties'
55
56
57res_ft = context.students_catalog(mode = full_time)
58dict['total_ft'] = len(res_ft)
59
60res_pt = context.students_catalog(mode = part_time)
61dict['total_pt'] = len(res_pt)
62
63res_dp = context.students_catalog(mode = diploma)
64dict['total_dp'] = len(res_dp)
65
66res_Aft = context.students_catalog(review_state = catA, mode = full_time)
67dict['total_Aft'] = len(res_Aft)
68
69res_Apt = context.students_catalog(review_state = catA, mode = part_time)
70dict['total_Apt'] = len(res_Apt)
71
72res_Adp = context.students_catalog(review_state = catA, mode = diploma)
73dict['total_Adp'] = len(res_Adp)
74
75res_Bft = context.students_catalog(review_state = catB, mode = full_time)
76dict['total_Bft'] = len(res_Bft)
77
78res_Bpt = context.students_catalog(review_state = catB, mode = part_time)
79dict['total_Bpt'] = len(res_Bpt)
80
81res_Bdp = context.students_catalog(review_state = catB, mode = diploma)
82dict['total_Bdp'] = len(res_Bpt)
83
84res_Cft = context.students_catalog(review_state = catC, mode = full_time)
85dict['total_Cft'] = len(res_Cft)
86
87res_Cpt = context.students_catalog(review_state = catC, mode = part_time)
88dict['total_Cpt'] = len(res_Cpt)
89
90res_Cdp = context.students_catalog(review_state = catC, mode = diploma)
91dict['total_Cdp'] = len(res_Cdp)
92
93
94res_total = context.students_catalog()
95dict['total_in_catalog'] = len(res_total)
96dict['not_categorized'] = dict['total_in_catalog'] - dict['total_Aft'] - dict['total_Apt'] - dict['total_Adp'] - dict['total_Cft'] - dict['total_Cpt'] - dict['total_Cdp']
97
98l.append(dict)
99
100
101for f in faculties:
102    dict = {}
103    dict['id'] = f.getId
104    dict['title'] = f.Title
105   
106    res_ft = context.students_catalog(faculty = f.getId, mode = full_time)
107    dict['total_ft'] = len(res_ft)
108
109    res_pt = context.students_catalog(faculty = f.getId, mode = part_time)
110    dict['total_pt'] = len(res_pt)
111
112    res_dp = context.students_catalog(faculty = f.getId, mode = diploma)
113    dict['total_dp'] = len(res_dp)   
114   
115    res_Aft = context.students_catalog(faculty = f.getId, review_state = catA, mode = full_time)
116    dict['total_Aft'] = len(res_Aft)
117
118    res_Apt = context.students_catalog(faculty = f.getId, review_state = catA, mode = part_time)
119    dict['total_Apt'] = len(res_Apt)
120
121    res_Adp = context.students_catalog(faculty = f.getId, review_state = catA, mode = diploma)
122    dict['total_Adp'] = len(res_Adp)
123
124    res_Bft = context.students_catalog(faculty = f.getId, review_state = catB, mode = full_time)
125    dict['total_Bft'] = len(res_Bft)
126
127    res_Bpt = context.students_catalog(faculty = f.getId, review_state = catB, mode = part_time)
128    dict['total_Bpt'] = len(res_Bpt)
129
130    res_Bdp = context.students_catalog(faculty = f.getId, review_state = catB, mode = diploma)
131    dict['total_Bdp'] = len(res_Bpt)
132
133    res_Cft = context.students_catalog(faculty = f.getId, review_state = catC, mode = full_time)
134    dict['total_Cft'] = len(res_Cft)
135
136    res_Cpt = context.students_catalog(faculty = f.getId, review_state = catC, mode = part_time)
137    dict['total_Cpt'] = len(res_Cpt)
138
139    res_Cdp = context.students_catalog(faculty = f.getId, review_state = catC, mode = diploma)
140    dict['total_Cdp'] = len(res_Cdp)
141
142
143    l.append(dict)
144
145return l
146
147
Note: See TracBrowser for help on using the repository browser.