source: WAeUP_SRP/aaua/waeup_custom/getSimpleStudentStatistics.py @ 3718

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

customize statistics

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