source: WAeUP_SRP/trunk/skins/waeup_aaua/getSimpleStudentStatistics.py @ 3999

Last change on this file since 3999 was 3690, checked in by Henrik Bettermann, 16 years ago

Move all customized skins into trunk. The waeup_custom skin together with the default profile is the BASE configuration which is identical to the Uniben set-up.

File size: 3.8 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
21
22
23catA =      (      'school_fee_paid',
24                   'courses_registered',
25                   'courses_validated',
26                   )
27
28catB =      (      'courses_registered',
29                   'courses_validated',
30                   )
31
32catC =      (      'student_created',
33                   'returning',
34                   'admitted',
35                   'clearance_pin_entered',
36                   'objection_raised',
37                   'clearance_requested',
38                   'cleared_and_validated',
39                   )
40
41current_session = context.getSessionId()[0]
42
43
44returning =  ('110','120','200','210','220','300','310','320','400','410','420','500','510', '520','500','510','520','610','620','700','710','720','800','810','820',)
45new =        ('100','600')
46
47
48faculties = context.portal_catalog(portal_type="Faculty")
49
50l = []
51
52fac_res = {}
53
54dict = {}
55dict['id'] = 'All Faculties'
56dict['title'] = 'All Faculties'
57
58
59res_ft = context.students_catalog(level = returning)
60dict['total_ft'] = len(res_ft)
61
62res_pt = context.students_catalog(level = new)
63dict['total_pt'] = len(res_pt)
64
65res_Aft = context.students_catalog(review_state = catA, level = returning, session = current_session)
66dict['total_Aft'] = len(res_Aft)
67
68res_Apt = context.students_catalog(review_state = catA, level = new, session = current_session)
69dict['total_Apt'] = len(res_Apt)
70
71
72
73res_Bft = context.students_catalog(review_state = catB, level = returning, session = current_session)
74dict['total_Bft'] = len(res_Bft)
75
76res_Bpt = context.students_catalog(review_state = catB, level = new, session = current_session)
77dict['total_Bpt'] = len(res_Bpt)
78
79
80
81res_Cft = context.students_catalog(review_state = catC, level = returning, session = current_session)
82dict['total_Cft'] = len(res_Cft)
83
84res_Cpt = context.students_catalog(review_state = catC, level = new, session = current_session)
85dict['total_Cpt'] = len(res_Cpt)
86
87
88
89
90res_total = context.students_catalog()
91dict['total_in_catalog'] = len(res_total)
92dict['not_categorized'] = dict['total_in_catalog'] - dict['total_ft'] - dict['total_pt']
93
94l.append(dict)
95
96
97for f in faculties:
98    dict = {}
99    dict['id'] = f.getId
100    dict['title'] = f.Title
101
102    res_ft = context.students_catalog(faculty = f.getId, level = returning)
103    dict['total_ft'] = len(res_ft)
104
105    res_pt = context.students_catalog(faculty = f.getId, level = new)
106    dict['total_pt'] = len(res_pt)
107
108
109    res_Aft = context.students_catalog(faculty = f.getId, review_state = catA, level = returning, session = current_session)
110    dict['total_Aft'] = len(res_Aft)
111
112    res_Apt = context.students_catalog(faculty = f.getId, review_state = catA, level = new, session = current_session)
113    dict['total_Apt'] = len(res_Apt)
114
115
116
117    res_Bft = context.students_catalog(faculty = f.getId, review_state = catB, level = returning, session = current_session)
118    dict['total_Bft'] = len(res_Bft)
119
120    res_Bpt = context.students_catalog(faculty = f.getId, review_state = catB, level = new, session = current_session)
121    dict['total_Bpt'] = len(res_Bpt)
122
123
124
125    res_Cft = context.students_catalog(faculty = f.getId, review_state = catC, level = returning, session = current_session)
126    dict['total_Cft'] = len(res_Cft)
127
128    res_Cpt = context.students_catalog(faculty = f.getId, review_state = catC, level = new, session = current_session)
129    dict['total_Cpt'] = len(res_Cpt)
130
131
132
133
134    l.append(dict)
135
136return l
137
Note: See TracBrowser for help on using the repository browser.