source: WAeUP_SRP/fceokene/waeup_custom/getSimpleStudentStatistics.py @ 2633

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

School instead of Faculty

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