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

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

number of imported students which is not the sum of A and C

File size: 3.9 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
56res_Aft = context.students_catalog(review_state = catA, mode = full_time)
57dict['total_Aft'] = len(res_Aft)
58
59res_Apt = context.students_catalog(review_state = catA, mode = part_time)
60dict['total_Apt'] = len(res_Apt)
61
62res_Adp = context.students_catalog(review_state = catA, mode = diploma)
63dict['total_Adp'] = len(res_Adp)
64
65res_Bft = context.students_catalog(review_state = catB, mode = full_time)
66dict['total_Bft'] = len(res_Bft)
67
68res_Bpt = context.students_catalog(review_state = catB, mode = part_time)
69dict['total_Bpt'] = len(res_Bpt)
70
71res_Bdp = context.students_catalog(review_state = catB, mode = diploma)
72dict['total_Bdp'] = len(res_Bpt)
73
74res_Cft = context.students_catalog(review_state = catC, mode = full_time)
75dict['total_Cft'] = len(res_Cft)
76
77res_Cpt = context.students_catalog(review_state = catC, mode = part_time)
78dict['total_Cpt'] = len(res_Cpt)
79
80res_Cdp = context.students_catalog(review_state = catC, mode = diploma)
81dict['total_Cdp'] = len(res_Cdp)
82
83
84res_total = context.students_catalog()
85dict['total_in_catalog'] = len(res_total)
86dict['not_categorized'] = dict['total_in_catalog'] - dict['total_Aft'] - dict['total_Apt'] - dict['total_Adp'] - dict['total_Cft'] - dict['total_Cpt'] - dict['total_Cdp']
87
88l.append(dict)
89
90
91for f in faculties:
92    dict = {}
93    dict['id'] = f.getId
94    dict['title'] = f.Title
95    res_Aft = context.students_catalog(faculty = f.getId, review_state = catA, mode = full_time)
96    dict['total_Aft'] = len(res_Aft)
97
98    res_Apt = context.students_catalog(faculty = f.getId, review_state = catA, mode = part_time)
99    dict['total_Apt'] = len(res_Apt)
100
101    res_Adp = context.students_catalog(faculty = f.getId, review_state = catA, mode = diploma)
102    dict['total_Adp'] = len(res_Adp)
103
104    res_Bft = context.students_catalog(faculty = f.getId, review_state = catB, mode = full_time)
105    dict['total_Bft'] = len(res_Bft)
106
107    res_Bpt = context.students_catalog(faculty = f.getId, review_state = catB, mode = part_time)
108    dict['total_Bpt'] = len(res_Bpt)
109
110    res_Bdp = context.students_catalog(faculty = f.getId, review_state = catB, mode = diploma)
111    dict['total_Bdp'] = len(res_Bpt)
112
113    res_Cft = context.students_catalog(faculty = f.getId, review_state = catC, mode = full_time)
114    dict['total_Cft'] = len(res_Cft)
115
116    res_Cpt = context.students_catalog(faculty = f.getId, review_state = catC, mode = part_time)
117    dict['total_Cpt'] = len(res_Cpt)
118
119    res_Cdp = context.students_catalog(faculty = f.getId, review_state = catC, mode = diploma)
120    dict['total_Cdp'] = len(res_Cdp)
121
122
123    l.append(dict)
124
125return l
126
127
Note: See TracBrowser for help on using the repository browser.