[2068] | 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 |
---|
[2070] | 16 | logger = logging.getLogger('Skins.getSimpleStudentStatistics') |
---|
[2068] | 17 | |
---|
| 18 | logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember()) |
---|
| 19 | if 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 | |
---|
| 24 | catA = ( 'school_fee_paid', |
---|
| 25 | 'courses_registered', |
---|
| 26 | 'courses_validated', |
---|
| 27 | ) |
---|
| 28 | |
---|
| 29 | catB = ( 'courses_registered', |
---|
| 30 | 'courses_validated', |
---|
| 31 | ) |
---|
[2070] | 32 | |
---|
[2088] | 33 | catC = ( 'returning', |
---|
| 34 | 'admitted', |
---|
[2068] | 35 | 'clearance_pin_entered', |
---|
| 36 | 'objection_raised', |
---|
| 37 | 'clearance_requested', |
---|
| 38 | 'cleared_and_validated', |
---|
[2070] | 39 | ) |
---|
[2068] | 40 | |
---|
| 41 | |
---|
| 42 | full_time = ('ume_ft','de_ft','ug_ft','pg_ft') |
---|
[2070] | 43 | part_time = ( 'de_pt','ug_pt','pg_pt') |
---|
[2068] | 44 | diploma = ('dp_ft','dp_pt') |
---|
[2070] | 45 | |
---|
| 46 | |
---|
[2068] | 47 | faculties = context.portal_catalog(portal_type="Faculty") |
---|
| 48 | |
---|
| 49 | l = [] |
---|
| 50 | |
---|
| 51 | fac_res = {} |
---|
| 52 | |
---|
| 53 | dict = {} |
---|
| 54 | dict['id'] = 'All Faculties' |
---|
| 55 | dict['title'] = 'All Faculties' |
---|
| 56 | |
---|
[2087] | 57 | |
---|
| 58 | res_ft = context.students_catalog(mode = full_time) |
---|
| 59 | dict['total_ft'] = len(res_ft) |
---|
| 60 | |
---|
| 61 | res_pt = context.students_catalog(mode = part_time) |
---|
| 62 | dict['total_pt'] = len(res_pt) |
---|
| 63 | |
---|
| 64 | res_dp = context.students_catalog(mode = diploma) |
---|
| 65 | dict['total_dp'] = len(res_dp) |
---|
| 66 | |
---|
[2068] | 67 | res_Aft = context.students_catalog(review_state = catA, mode = full_time) |
---|
| 68 | dict['total_Aft'] = len(res_Aft) |
---|
| 69 | |
---|
| 70 | res_Apt = context.students_catalog(review_state = catA, mode = part_time) |
---|
| 71 | dict['total_Apt'] = len(res_Apt) |
---|
| 72 | |
---|
| 73 | res_Adp = context.students_catalog(review_state = catA, mode = diploma) |
---|
| 74 | dict['total_Adp'] = len(res_Adp) |
---|
| 75 | |
---|
| 76 | res_Bft = context.students_catalog(review_state = catB, mode = full_time) |
---|
| 77 | dict['total_Bft'] = len(res_Bft) |
---|
| 78 | |
---|
| 79 | res_Bpt = context.students_catalog(review_state = catB, mode = part_time) |
---|
| 80 | dict['total_Bpt'] = len(res_Bpt) |
---|
| 81 | |
---|
| 82 | res_Bdp = context.students_catalog(review_state = catB, mode = diploma) |
---|
| 83 | dict['total_Bdp'] = len(res_Bpt) |
---|
| 84 | |
---|
| 85 | res_Cft = context.students_catalog(review_state = catC, mode = full_time) |
---|
| 86 | dict['total_Cft'] = len(res_Cft) |
---|
| 87 | |
---|
| 88 | res_Cpt = context.students_catalog(review_state = catC, mode = part_time) |
---|
| 89 | dict['total_Cpt'] = len(res_Cpt) |
---|
| 90 | |
---|
| 91 | res_Cdp = context.students_catalog(review_state = catC, mode = diploma) |
---|
[2070] | 92 | dict['total_Cdp'] = len(res_Cdp) |
---|
[2068] | 93 | |
---|
[2070] | 94 | |
---|
| 95 | res_total = context.students_catalog() |
---|
| 96 | dict['total_in_catalog'] = len(res_total) |
---|
| 97 | dict['not_categorized'] = dict['total_in_catalog'] - dict['total_Aft'] - dict['total_Apt'] - dict['total_Adp'] - dict['total_Cft'] - dict['total_Cpt'] - dict['total_Cdp'] |
---|
| 98 | |
---|
[2068] | 99 | l.append(dict) |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | for f in faculties: |
---|
| 103 | dict = {} |
---|
| 104 | dict['id'] = f.getId |
---|
| 105 | dict['title'] = f.Title |
---|
[2088] | 106 | |
---|
[2087] | 107 | res_ft = context.students_catalog(faculty = f.getId, mode = full_time) |
---|
| 108 | dict['total_ft'] = len(res_ft) |
---|
| 109 | |
---|
| 110 | res_pt = context.students_catalog(faculty = f.getId, mode = part_time) |
---|
| 111 | dict['total_pt'] = len(res_pt) |
---|
| 112 | |
---|
| 113 | res_dp = context.students_catalog(faculty = f.getId, mode = diploma) |
---|
[2088] | 114 | dict['total_dp'] = len(res_dp) |
---|
| 115 | |
---|
[2068] | 116 | res_Aft = context.students_catalog(faculty = f.getId, review_state = catA, mode = full_time) |
---|
| 117 | dict['total_Aft'] = len(res_Aft) |
---|
[2070] | 118 | |
---|
[2068] | 119 | res_Apt = context.students_catalog(faculty = f.getId, review_state = catA, mode = part_time) |
---|
| 120 | dict['total_Apt'] = len(res_Apt) |
---|
| 121 | |
---|
| 122 | res_Adp = context.students_catalog(faculty = f.getId, review_state = catA, mode = diploma) |
---|
| 123 | dict['total_Adp'] = len(res_Adp) |
---|
| 124 | |
---|
| 125 | res_Bft = context.students_catalog(faculty = f.getId, review_state = catB, mode = full_time) |
---|
| 126 | dict['total_Bft'] = len(res_Bft) |
---|
| 127 | |
---|
| 128 | res_Bpt = context.students_catalog(faculty = f.getId, review_state = catB, mode = part_time) |
---|
| 129 | dict['total_Bpt'] = len(res_Bpt) |
---|
| 130 | |
---|
| 131 | res_Bdp = context.students_catalog(faculty = f.getId, review_state = catB, mode = diploma) |
---|
| 132 | dict['total_Bdp'] = len(res_Bpt) |
---|
| 133 | |
---|
| 134 | res_Cft = context.students_catalog(faculty = f.getId, review_state = catC, mode = full_time) |
---|
| 135 | dict['total_Cft'] = len(res_Cft) |
---|
| 136 | |
---|
| 137 | res_Cpt = context.students_catalog(faculty = f.getId, review_state = catC, mode = part_time) |
---|
| 138 | dict['total_Cpt'] = len(res_Cpt) |
---|
| 139 | |
---|
| 140 | res_Cdp = context.students_catalog(faculty = f.getId, review_state = catC, mode = diploma) |
---|
[2070] | 141 | dict['total_Cdp'] = len(res_Cdp) |
---|
| 142 | |
---|
| 143 | |
---|
[2068] | 144 | l.append(dict) |
---|
| 145 | |
---|
| 146 | return l |
---|
| 147 | |
---|
| 148 | |
---|