source: main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py @ 8807

Last change on this file since 8807 was 8647, checked in by Henrik Bettermann, 13 years ago

Customized applicants statistics (temporarily disabled).

  • Property svn:keywords set to Id
File size: 3.3 KB
RevLine 
[7696]1## $Id: utils.py 8647 2012-06-07 18:37:06Z 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
[8526]21from time import time
[8247]22import sys
[7696]23import grok
[8647]24from zope.catalog.interfaces import ICatalog
[8247]25from hurry.workflow.interfaces import IWorkflowInfo, InvalidTransitionError
[7822]26from waeup.kofa.applicants.utils import ApplicantsUtils
[8647]27from waeup.kofa.applicants.interfaces import IApplicantsUtils
28from waeup.kofa.applicants.workflow import (INITIALIZED,
29    STARTED, PAID, ADMITTED, NOT_ADMITTED, SUBMITTED, CREATED)
[8051]30from waeup.uniben.interfaces import MessageFactory as _
[7696]31
[8247]32
[8647]33
[7696]34class ApplicantsUtils(ApplicantsUtils):
35    """A collection of parameters and methods subject to customization.
36    """
37
[7845]38    APP_TYPES_DICT = {
[8561]39        'pude': ['Post-UDE Screening', 'PUDE'],
[7845]40        'prence': ['Pre-NCE Programme', 'PRE'],
[8561]41        'sandwich': ['Part-Time Degree in Education', 'SAND'],
[7845]42        'pt': ['Part-Time Degree Programmes', 'PTP'],
[8561]43        'putme': ['Post-UTME Screening Exercise', 'PUTME'],
[7845]44        'app': ['General Studies', 'APP'],
45        'cest': ['Common Entry Screening Test', 'CEST'],
46        'ct': ['Certificate Programmes', 'CTP'],
47        'dp': ['Diploma Programmes', 'DPP'],
[8012]48        'pce': ['PCE Screening', 'PCE'],
[8064]49        'pgft': ['Postgraduate Full-Time Programmes', 'PG'],
50        'pgpt': ['Postgraduate Part-Time Programmes', 'PG']
[7696]51        }
[8051]52
53    SEPARATORS_DICT = {
54        'form.applicant_id': _(u'Base Data'),
55        'form.course1': _(u'Programmes/Courses Desired'),
56        'form.hq_type': _(u'Higher Education Record'),
57        'form.presently': _(u'Course or Programme Presently Attending'),
58        'form.nysc_year': _(u'NYSC Information'),
[8101]59        'form.employer': _(u'Employment History'),
[8535]60        'form.jamb_subjects': _(u'JAMB Data'),
[8051]61        'form.notice': _(u'Application Process Information'),
62        'form.pp_school': _(u'Post Primary School Qualification'),
[8101]63        'form.presently_inst': _(u'Presently attending a course or programme'),
[8051]64        }
[8647]65
66    # Temporarily disabled
67    def xxx_getApplicantsStatistics(self, container):
68        state_stats = {INITIALIZED:0, STARTED:0, PAID:0, SUBMITTED:0,
69            ADMITTED:0, NOT_ADMITTED:0, CREATED:0}
70        faculty_keys = grok.getSite()['faculties'].keys()
71        fac_stats = dict([(i,0) for i in faculty_keys])
72        for key in container.keys():
73            state = container[key].state
74            state_stats[state] += 1
75            cert = getattr(container[key],'course1',None)
76            if  cert is not None and state == SUBMITTED:
77                faculty = cert.__parent__.__parent__.__parent__
78                fac_stats[faculty.__name__] += 1
79        return state_stats, fac_stats
Note: See TracBrowser for help on using the repository browser.