[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 | """ |
---|
| 12 | return Student Statistics |
---|
| 13 | """ |
---|
| 14 | |
---|
| 15 | import logging |
---|
| 16 | logger = logging.getLogger('Skins.getSimpleStudentStatistics') |
---|
| 17 | |
---|
| 18 | logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember()) |
---|
| 19 | if not context.isStaff(): |
---|
[2724] | 20 | return |
---|
[2362] | 21 | |
---|
| 22 | |
---|
| 23 | catA = ( 'school_fee_paid', |
---|
| 24 | 'courses_registered', |
---|
| 25 | 'courses_validated', |
---|
| 26 | ) |
---|
| 27 | |
---|
| 28 | catB = ( 'courses_registered', |
---|
| 29 | 'courses_validated', |
---|
| 30 | ) |
---|
| 31 | |
---|
[2724] | 32 | catC = ( 'student_created', |
---|
| 33 | 'returning', |
---|
[2362] | 34 | 'admitted', |
---|
| 35 | 'clearance_pin_entered', |
---|
| 36 | 'objection_raised', |
---|
| 37 | 'clearance_requested', |
---|
| 38 | 'cleared_and_validated', |
---|
| 39 | ) |
---|
| 40 | |
---|
[2724] | 41 | current_session = context.getSessionId()[0] |
---|
[2362] | 42 | |
---|
| 43 | |
---|
[3575] | 44 | returning = ('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',) |
---|
| 45 | new = ('100','600') |
---|
[2362] | 46 | |
---|
[2724] | 47 | |
---|
[2362] | 48 | faculties = context.portal_catalog(portal_type="Faculty") |
---|
| 49 | |
---|
| 50 | l = [] |
---|
| 51 | |
---|
| 52 | fac_res = {} |
---|
| 53 | |
---|
| 54 | dict = {} |
---|
[3575] | 55 | dict['id'] = 'All Faculties' |
---|
| 56 | dict['title'] = 'All Faculties' |
---|
[2362] | 57 | |
---|
| 58 | |
---|
[3075] | 59 | res_ft = context.students_catalog(level = returning) |
---|
[2362] | 60 | dict['total_ft'] = len(res_ft) |
---|
| 61 | |
---|
[3075] | 62 | res_pt = context.students_catalog(level = new) |
---|
[2362] | 63 | dict['total_pt'] = len(res_pt) |
---|
| 64 | |
---|
[3075] | 65 | res_Aft = context.students_catalog(review_state = catA, level = returning, session = current_session) |
---|
[2362] | 66 | dict['total_Aft'] = len(res_Aft) |
---|
| 67 | |
---|
[3075] | 68 | res_Apt = context.students_catalog(review_state = catA, level = new, session = current_session) |
---|
[2362] | 69 | dict['total_Apt'] = len(res_Apt) |
---|
| 70 | |
---|
| 71 | |
---|
[3575] | 72 | |
---|
[3075] | 73 | res_Bft = context.students_catalog(review_state = catB, level = returning, session = current_session) |
---|
[2362] | 74 | dict['total_Bft'] = len(res_Bft) |
---|
| 75 | |
---|
[3075] | 76 | res_Bpt = context.students_catalog(review_state = catB, level = new, session = current_session) |
---|
[2362] | 77 | dict['total_Bpt'] = len(res_Bpt) |
---|
| 78 | |
---|
| 79 | |
---|
[3575] | 80 | |
---|
[3075] | 81 | res_Cft = context.students_catalog(review_state = catC, level = returning, session = current_session) |
---|
[2362] | 82 | dict['total_Cft'] = len(res_Cft) |
---|
| 83 | |
---|
[3075] | 84 | res_Cpt = context.students_catalog(review_state = catC, level = new, session = current_session) |
---|
[2362] | 85 | dict['total_Cpt'] = len(res_Cpt) |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | |
---|
[3575] | 89 | |
---|
[2362] | 90 | res_total = context.students_catalog() |
---|
| 91 | dict['total_in_catalog'] = len(res_total) |
---|
[3575] | 92 | dict['not_categorized'] = dict['total_in_catalog'] - dict['total_ft'] - dict['total_pt'] |
---|
[2362] | 93 | |
---|
| 94 | l.append(dict) |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | for 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 | |
---|
| 136 | return l |
---|
| 137 | |
---|