[7696] | 1 | ## $Id: utils.py 11434 2014-02-25 06:14:03Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | """General helper functions and utilities for the application section. |
---|
| 19 | """ |
---|
| 20 | |
---|
[8821] | 21 | from kofacustom.nigeria.applicants.utils import NigeriaApplicantsUtils |
---|
[8647] | 22 | from waeup.kofa.applicants.workflow import (INITIALIZED, |
---|
| 23 | STARTED, PAID, ADMITTED, NOT_ADMITTED, SUBMITTED, CREATED) |
---|
[8051] | 24 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
[7696] | 25 | |
---|
[8247] | 26 | |
---|
[8647] | 27 | |
---|
[8821] | 28 | class ApplicantsUtils(NigeriaApplicantsUtils): |
---|
[7696] | 29 | """A collection of parameters and methods subject to customization. |
---|
| 30 | """ |
---|
| 31 | |
---|
[9635] | 32 | APP_TYPES_DICT = { |
---|
| 33 | 'pude': ['Post-UDE Screening', 'PUDE'], |
---|
| 34 | 'prence': ['Pre-NCE Programme', 'PRE'], |
---|
| 35 | 'sandwich': ['Part-Time Degree in Education', 'SAND'], |
---|
| 36 | 'pt': ['Part-Time Degree Programmes', 'PTP'], |
---|
| 37 | 'putme': ['Post-UTME Screening Exercise', 'PUTME'], |
---|
| 38 | 'app': ['General Studies', 'APP'], |
---|
| 39 | 'cest': ['Common Entry Screening Test', 'CEST'], |
---|
| 40 | 'ct': ['Certificate Programmes', 'CTP'], |
---|
| 41 | 'dp': ['Diploma Programmes', 'DPP'], |
---|
| 42 | 'dpft': ['Diploma Full-Time Programmes', 'DPP'], |
---|
| 43 | 'pce': ['PCE Screening', 'PCE'], |
---|
[11434] | 44 | 'pg': ['Postgraduate Programmes', 'PG'], |
---|
[9635] | 45 | 'pgft': ['Postgraduate Full-Time Programmes', 'PG'], |
---|
| 46 | 'pgpt': ['Postgraduate Part-Time Programmes', 'PG'], |
---|
[11434] | 47 | 'pgnew': ['New Postgraduate Programmes', 'NEWPG'], |
---|
| 48 | 'pgext': ['Postgraduate Programmes (extended application)', 'PG'] |
---|
[9635] | 49 | } |
---|
| 50 | |
---|
| 51 | |
---|
[8647] | 52 | # Temporarily disabled |
---|
| 53 | def xxx_getApplicantsStatistics(self, container): |
---|
| 54 | state_stats = {INITIALIZED:0, STARTED:0, PAID:0, SUBMITTED:0, |
---|
| 55 | ADMITTED:0, NOT_ADMITTED:0, CREATED:0} |
---|
| 56 | faculty_keys = grok.getSite()['faculties'].keys() |
---|
| 57 | fac_stats = dict([(i,0) for i in faculty_keys]) |
---|
| 58 | for key in container.keys(): |
---|
| 59 | state = container[key].state |
---|
| 60 | state_stats[state] += 1 |
---|
| 61 | cert = getattr(container[key],'course1',None) |
---|
| 62 | if cert is not None and state == SUBMITTED: |
---|
| 63 | faculty = cert.__parent__.__parent__.__parent__ |
---|
| 64 | fac_stats[faculty.__name__] += 1 |
---|
| 65 | return state_stats, fac_stats |
---|