Last change
on this file since 17397 was
1788,
checked in by Henrik Bettermann, 18 years ago
|
- missing icons added
- getStatistics has to take into consideration that entry_session is stored in two different ways
|
File size:
2.0 KB
|
Line | |
---|
1 | ## Script (Python) "getNewStudentStatistics" |
---|
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 | """ |
---|
12 | return Student Statistics |
---|
13 | """ |
---|
14 | |
---|
15 | import logging |
---|
16 | logger = logging.getLogger('Skins.getNewStudentStatistics') |
---|
17 | |
---|
18 | logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember()) |
---|
19 | if not context.isStaff(): |
---|
20 | return 'Not allowed' |
---|
21 | |
---|
22 | entry_sessions = ('06','6') |
---|
23 | |
---|
24 | new_states = ('admitted', |
---|
25 | 'clearance_pin_entered', |
---|
26 | 'objection_raised', |
---|
27 | 'clearance_requested', |
---|
28 | 'cleared_and_validated', |
---|
29 | 'school_fee_paid', |
---|
30 | 'courses_registered', |
---|
31 | 'courses_validated', |
---|
32 | ) |
---|
33 | faculties = context.portal_catalog(portal_type="Faculty") |
---|
34 | |
---|
35 | l = [] |
---|
36 | |
---|
37 | |
---|
38 | fac_res = {} |
---|
39 | |
---|
40 | dict = {} |
---|
41 | dict['id'] = 'All Faculties' |
---|
42 | dict['title'] = 'All Faculties' |
---|
43 | res = context.students_catalog(entry_session = entry_sessions) |
---|
44 | dict['total'] = len(res) |
---|
45 | for state in new_states: |
---|
46 | res = context.students_catalog(entry_session = entry_sessions, review_state = state) |
---|
47 | dict[state] = len(res) |
---|
48 | statepercent = state+'_percent' |
---|
49 | if dict['total'] > 0: |
---|
50 | dict[statepercent] = "%.0f" % round(dict[state]*100.0/dict['total']) |
---|
51 | else: |
---|
52 | dict[statepercent] = 0 |
---|
53 | l.append(dict) |
---|
54 | |
---|
55 | for f in faculties: |
---|
56 | dict = {} |
---|
57 | dict['id'] = f.getId |
---|
58 | dict['title'] = f.Title |
---|
59 | res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId) |
---|
60 | dict['total'] = len(res) |
---|
61 | for state in new_states: |
---|
62 | res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, review_state = state) |
---|
63 | dict[state] = len(res) |
---|
64 | statepercent = state+'_percent' |
---|
65 | if dict['total'] > 0: |
---|
66 | dict[statepercent] = "%.0f" % round(dict[state]*100.0/dict['total']) |
---|
67 | else: |
---|
68 | dict[statepercent] = 0 |
---|
69 | l.append(dict) |
---|
70 | |
---|
71 | return l |
---|
72 | |
---|
73 | |
---|
Note: See
TracBrowser for help on using the repository browser.