source: WAeUP_SRP/trunk/skins/waeup_fceokene/getPaymentStatistics.py @ 13041

Last change on this file since 13041 was 5560, checked in by Henrik Bettermann, 14 years ago

Implement payment statistics.

  • Property svn:keywords set to Id
File size: 5.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=session_id=None
8##title=
9##
10# $Id: getPaymentStatistics.py 5560 2010-10-06 08:05:01Z henrik $
11"""
12return Payment Statistics
13"""
14
15from Products.AdvancedQuery import Eq, Between, Le,In
16
17import logging
18logger = logging.getLogger('Skins.getPaymentStatistics')
19
20import DateTime,csv
21
22member = context.portal_membership.getAuthenticatedMember()
23logger.info('%s invoked statistics' % member)
24if not context.isStaff():
25    return
26
27ARTS = ('CRS','ISS','HIS','MUS','ECO','GEO','POL','SOS','CCA','ECU','THA','GED','GSE','PES','SPC','ENG ','FRE','ARB','HAU','IGB','YOR')
28
29#SCS = ('BIO','CHE','HED','MAT','PED','PHY ','CSC','ISC','PHE','AGE','BED','HEC','TED','FAA')
30
31catA =      (      'school_fee_paid',
32                   'courses_registered',
33                   'courses_validated',
34                   )
35                   
36if not session_id:
37    session_id  = context.getSessionId()[0]
38
39L1 = ('100','110','120')
40L2 = ('200','210','220')
41L3 = ('300','310','320')
42L4 = ('400','410','420')
43L5 = ('500','510','520')
44L6 = ('600','610','620')
45
46d = {}
47
48query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','pd_ft')
49d['pd_ft'] = len(context.students_catalog.evalAdvancedQuery(query))
50
51query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','prence') & In('department',ARTS)
52d['prence_arts'] = len(context.students_catalog.evalAdvancedQuery(query))
53
54query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','prence') & ~In('department',ARTS)
55d['prence_sci'] = len(context.students_catalog.evalAdvancedQuery(query))
56
57# regular students
58
59query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & In('department',ARTS) & In('level',L1)
60d['ug_ft_arts_100'] = len(context.students_catalog.evalAdvancedQuery(query))
61
62query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & ~In('department',ARTS) & In('level',L1)
63d['ug_ft_sci_100'] = len(context.students_catalog.evalAdvancedQuery(query))
64
65query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & In('department',ARTS) & In('level',L2)
66d['ug_ft_arts_200'] = len(context.students_catalog.evalAdvancedQuery(query))
67
68query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & ~In('department',ARTS) & In('level',L2)
69d['ug_ft_sci_200'] = len(context.students_catalog.evalAdvancedQuery(query))
70
71query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & In('department',ARTS) & In('level',L3)
72d['ug_ft_arts_300'] = len(context.students_catalog.evalAdvancedQuery(query))
73
74query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & ~In('department',ARTS) & In('level',L3)
75d['ug_ft_sci_300'] = len(context.students_catalog.evalAdvancedQuery(query))
76
77query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & In('department',ARTS) & In('level',L4)
78d['ug_ft_arts_rep'] = len(context.students_catalog.evalAdvancedQuery(query))
79
80query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_ft') & ~In('department',ARTS) & In('level',L4)
81d['ug_ft_sci_rep'] = len(context.students_catalog.evalAdvancedQuery(query))
82
83# sandwich
84
85query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & In('department',ARTS) & In('level',L1)
86d['ug_sw_arts_100'] = len(context.students_catalog.evalAdvancedQuery(query))
87
88query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',ARTS) & In('level',L1)
89d['ug_sw_sci_100'] = len(context.students_catalog.evalAdvancedQuery(query))
90
91query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & In('department',ARTS) & In('level',L2)
92d['ug_sw_arts_200'] = len(context.students_catalog.evalAdvancedQuery(query))
93
94query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',ARTS) & In('level',L2)
95d['ug_sw_sci_200'] = len(context.students_catalog.evalAdvancedQuery(query))
96
97query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & In('department',ARTS) & In('level',L3)
98d['ug_sw_arts_300'] = len(context.students_catalog.evalAdvancedQuery(query))
99
100query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',ARTS) & In('level',L3)
101d['ug_sw_sci_300'] = len(context.students_catalog.evalAdvancedQuery(query))
102
103query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & In('department',ARTS) & In('level',L4)
104d['ug_sw_arts_400'] = len(context.students_catalog.evalAdvancedQuery(query))
105
106query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',ARTS) & In('level',L4)
107d['ug_sw_sci_400'] = len(context.students_catalog.evalAdvancedQuery(query))
108
109query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & In('department',ARTS) & In('level',L5)
110d['ug_sw_arts_500'] = len(context.students_catalog.evalAdvancedQuery(query))
111
112query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',ARTS) & In('level',L5)
113d['ug_sw_sci_500'] = len(context.students_catalog.evalAdvancedQuery(query))
114
115query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & In('department',ARTS) & In('level',L6)
116d['ug_sw_arts_rep'] = len(context.students_catalog.evalAdvancedQuery(query))
117
118query = Eq('session',session_id) & In('review_state',catA) & Eq('mode','ug_sw') & ~In('department',ARTS) & In('level',L6)
119d['ug_sw_sci_rep'] = len(context.students_catalog.evalAdvancedQuery(query))
120
121
122l = []
123l += d,
124
125csv_name = context.waeup_tool.dumpListToCSV(l,'payments_statistics')
126logger.info('%s dumped payments statistics to %s' % (member,csv_name))
127
128return d
Note: See TracBrowser for help on using the repository browser.