[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 | |
---|
[3075] | 44 | returning = ('110','120','200','210','220','300','310','320',) |
---|
| 45 | new = ('100') |
---|
| 46 | prence = ('000') |
---|
[2362] | 47 | |
---|
[2724] | 48 | |
---|
[2362] | 49 | faculties = context.portal_catalog(portal_type="Faculty") |
---|
| 50 | |
---|
| 51 | l = [] |
---|
| 52 | |
---|
| 53 | fac_res = {} |
---|
| 54 | |
---|
| 55 | dict = {} |
---|
| 56 | dict['id'] = 'All Schools' |
---|
| 57 | dict['title'] = 'All Schools' |
---|
| 58 | |
---|
| 59 | |
---|
[3075] | 60 | res_ft = context.students_catalog(level = returning) |
---|
[2362] | 61 | dict['total_ft'] = len(res_ft) |
---|
| 62 | |
---|
[3075] | 63 | res_pt = context.students_catalog(level = new) |
---|
[2362] | 64 | dict['total_pt'] = len(res_pt) |
---|
| 65 | |
---|
[3075] | 66 | res_dp = context.students_catalog(level = prence) |
---|
[2362] | 67 | dict['total_dp'] = len(res_dp) |
---|
| 68 | |
---|
[3075] | 69 | res_Aft = context.students_catalog(review_state = catA, level = returning, session = current_session) |
---|
[2362] | 70 | dict['total_Aft'] = len(res_Aft) |
---|
| 71 | |
---|
[3075] | 72 | res_Apt = context.students_catalog(review_state = catA, level = new, session = current_session) |
---|
[2362] | 73 | dict['total_Apt'] = len(res_Apt) |
---|
| 74 | |
---|
[3075] | 75 | res_Adp = context.students_catalog(review_state = catA, level = prence, session = current_session) |
---|
[2362] | 76 | dict['total_Adp'] = len(res_Adp) |
---|
| 77 | |
---|
[3075] | 78 | res_Bft = context.students_catalog(review_state = catB, level = returning, session = current_session) |
---|
[2362] | 79 | dict['total_Bft'] = len(res_Bft) |
---|
| 80 | |
---|
[3075] | 81 | res_Bpt = context.students_catalog(review_state = catB, level = new, session = current_session) |
---|
[2362] | 82 | dict['total_Bpt'] = len(res_Bpt) |
---|
| 83 | |
---|
[3075] | 84 | res_Bdp = context.students_catalog(review_state = catB, level = prence, session = current_session) |
---|
[3050] | 85 | dict['total_Bdp'] = len(res_Bdp) |
---|
[2362] | 86 | |
---|
[3075] | 87 | res_Cft = context.students_catalog(review_state = catC, level = returning, session = current_session) |
---|
[2362] | 88 | dict['total_Cft'] = len(res_Cft) |
---|
| 89 | |
---|
[3075] | 90 | res_Cpt = context.students_catalog(review_state = catC, level = new, session = current_session) |
---|
[2362] | 91 | dict['total_Cpt'] = len(res_Cpt) |
---|
| 92 | |
---|
[3075] | 93 | res_Cdp = context.students_catalog(review_state = catC, level = prence, session = current_session) |
---|
[2362] | 94 | dict['total_Cdp'] = len(res_Cdp) |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | res_total = context.students_catalog() |
---|
| 98 | dict['total_in_catalog'] = len(res_total) |
---|
[2724] | 99 | dict['not_categorized'] = dict['total_in_catalog'] - dict['total_ft'] - dict['total_pt'] - dict['total_dp'] |
---|
[2362] | 100 | |
---|
| 101 | l.append(dict) |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | for f in faculties: |
---|
| 105 | dict = {} |
---|
| 106 | dict['id'] = f.getId |
---|
| 107 | dict['title'] = f.Title |
---|
| 108 | |
---|
[3075] | 109 | res_ft = context.students_catalog(faculty = f.getId, level = returning) |
---|
[2362] | 110 | dict['total_ft'] = len(res_ft) |
---|
| 111 | |
---|
[3075] | 112 | res_pt = context.students_catalog(faculty = f.getId, level = new) |
---|
[2362] | 113 | dict['total_pt'] = len(res_pt) |
---|
| 114 | |
---|
[3075] | 115 | res_dp = context.students_catalog(faculty = f.getId, level = prence) |
---|
[2362] | 116 | dict['total_dp'] = len(res_dp) |
---|
| 117 | |
---|
[3075] | 118 | res_Aft = context.students_catalog(faculty = f.getId, review_state = catA, level = returning, session = current_session) |
---|
[2362] | 119 | dict['total_Aft'] = len(res_Aft) |
---|
| 120 | |
---|
[3075] | 121 | res_Apt = context.students_catalog(faculty = f.getId, review_state = catA, level = new, session = current_session) |
---|
[2362] | 122 | dict['total_Apt'] = len(res_Apt) |
---|
| 123 | |
---|
[3075] | 124 | res_Adp = context.students_catalog(faculty = f.getId, review_state = catA, level = prence, session = current_session) |
---|
[2362] | 125 | dict['total_Adp'] = len(res_Adp) |
---|
| 126 | |
---|
[3075] | 127 | res_Bft = context.students_catalog(faculty = f.getId, review_state = catB, level = returning, session = current_session) |
---|
[2362] | 128 | dict['total_Bft'] = len(res_Bft) |
---|
| 129 | |
---|
[3075] | 130 | res_Bpt = context.students_catalog(faculty = f.getId, review_state = catB, level = new, session = current_session) |
---|
[2362] | 131 | dict['total_Bpt'] = len(res_Bpt) |
---|
| 132 | |
---|
[3075] | 133 | res_Bdp = context.students_catalog(faculty = f.getId, review_state = catB, level = prence, session = current_session) |
---|
[3050] | 134 | dict['total_Bdp'] = len(res_Bdp) |
---|
[2362] | 135 | |
---|
[3075] | 136 | res_Cft = context.students_catalog(faculty = f.getId, review_state = catC, level = returning, session = current_session) |
---|
[2362] | 137 | dict['total_Cft'] = len(res_Cft) |
---|
| 138 | |
---|
[3075] | 139 | res_Cpt = context.students_catalog(faculty = f.getId, review_state = catC, level = new, session = current_session) |
---|
[2362] | 140 | dict['total_Cpt'] = len(res_Cpt) |
---|
| 141 | |
---|
[3075] | 142 | res_Cdp = context.students_catalog(faculty = f.getId, review_state = catC, level = prence, session = current_session) |
---|
[2362] | 143 | dict['total_Cdp'] = len(res_Cdp) |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | l.append(dict) |
---|
| 147 | |
---|
| 148 | return l |
---|
| 149 | |
---|