source: main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py @ 15119

Last change on this file since 15119 was 14700, checked in by Henrik Bettermann, 7 years ago

Implement study_mode filter for lecturer pages.

  • Property svn:keywords set to Id
File size: 9.7 KB
RevLine 
[7569]1## $Id: utils.py 14700 2017-06-24 07:11:54Z henrik $
2##
3## Copyright (C) 2012 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##
[7822]18"""Customize general helper utilities for Kofa.
[7569]19"""
[13963]20
21import string
[8823]22from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
[7569]23
[8823]24class CustomKofaUtils(NigeriaKofaUtils):
[7569]25    """A collection of methods subject to customization.
26    """
[7845]27
28    PREFERRED_LANGUAGES_DICT = {
[9755]29        }
30
[14650]31    COURSE_CATEGORY_DICT = {
32        'C':'Core Course (C)',
33        'R':'Required Courses (R)',
34        'E':'Elective Courses (E)',
35        }
36
[9755]37    PAYMENT_CATEGORIES = {
38        'schoolfee': 'School Fee',
[13512]39        'schoolfee_1': 'School Fee Plus (1st instalment)',
40        'schoolfee_2': 'School Fee (2nd instalment)',
[13410]41        'schoolfee_incl': 'School Fee Plus',
[9755]42        'clearance': 'Acceptance Fee',
[13410]43        'clearance_incl': 'Acceptance Fee Plus',
[13424]44        'hostel_maintenance': 'Hostel Accommodation Fee',
[9755]45        'application': 'Application Fee',
46        'bed_allocation': 'Bed Allocation Fee',
47        'transfer': 'Transfer Fee',
[14296]48        'transcript_local': 'Local Transcript Fee',
49        'transcript_inter': 'International Transcript Fee',
[13035]50        'late_registration': 'Late Course Registration Fee',
[13402]51        'welfare': 'Student Welfare Assurance Fee',
[13463]52        'union': 'Student Union Dues',
[13402]53        'lapel': 'Lapel/File Fee',
[13374]54        'matric_gown': 'Matriculation Gown Fee',
55        'concessional': 'Concessional Fee',
[14234]56        'id_card': 'Student ID Card',
[14355]57        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
58        'gst_text_book_1': 'Text Book Fee GST101 GST102',
59        'gst_text_book_2': 'Text Book Fee GST111 GST112',
[14258]60        'gst_text_book_3': 'Text Book Fee GST222',
[14621]61        'ent_text_book_1': 'Text Book Fee ENT201',
[14258]62        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
63        'gst_registration_2': 'Registration Fee GST222',
[14620]64        'ent_registration_1': 'Registration Fee ENT201',
[14248]65        'fac_dep': 'Faculty and Departmental Dues',
[14375]66        'restitution': 'Restitution Fee',
[9755]67        }
68
69    SELECTABLE_PAYMENT_CATEGORIES = {
[13435]70        'schoolfee': 'School Fee without additional fees',
[13512]71        'schoolfee_1': 'School Fee (1st instalment) + Student Union Dues + Welfare Assurance Fee',
72        'schoolfee_2': 'School Fee (2nd instalment)',
[13463]73        'schoolfee_incl': 'School Fee + Student Union Dues + Welfare Assurance Fee',
[13435]74        'clearance': 'Acceptance Fee without additional fees',
[14239]75        'clearance_incl': 'Acceptance Fee + Matric Gown Fee + Lapel/File Fee',
[13454]76        'hostel_maintenance': 'Hostel Accommodation Fee',
[14243]77        #'application': 'Application Fee',
[11621]78        #'bed_allocation': 'Bed Allocation Fee',
79        #'transfer': 'Transfer Fee',
[14296]80        'transcript_local': 'Local Transcript Fee',
81        'transcript_inter': 'International Transcript Fee',
[13035]82        'late_registration': 'Late Course Registration Fee',
[14243]83        #'welfare': 'Student Welfare Assurance Fee',
84        #'union': 'Student Union Dues',
85        #'lapel': 'Lapel/File Fee',
86        #'matric_gown': 'Matriculation Gown Fee',
[13374]87        'concessional': 'Concessional Fee',
[14243]88        #'id_card': 'Student ID Card',
[14355]89        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
90        'gst_text_book_1': 'Text Book Fee GST101 GST102',
91        'gst_text_book_2': 'Text Book Fee GST111 GST112',
[14258]92        'gst_text_book_3': 'Text Book Fee GST222',
[14621]93        'ent_text_book_1': 'Text Book Fee ENT201',
[14258]94        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
95        'gst_registration_2': 'Registration Fee GST222',
[14620]96        'ent_registration_1': 'Registration Fee ENT201',
[14501]97        #'fac_dep': 'Faculty and Departmental Dues',
[14375]98        'restitution': 'Restitution Fee',
[9755]99        }
100
[13451]101    REPORTABLE_PAYMENT_CATEGORIES = {
102        'schoolfee': 'School Fee',
[13452]103        'schoolfee_incl': 'School Fee Plus',
[13635]104        'schoolfee_1': 'School Fee 1 Plus',
105        'schoolfee_2': 'School Fee 2',
[13451]106        'clearance': 'Acceptance Fee',
[13452]107        'clearance_incl': 'Acceptance Fee Plus',
[13451]108        'hostel_maintenance': 'Hostel Maintenance Fee',
109        }
110
[13638]111    BALANCE_PAYMENT_CATEGORIES = {
112        'schoolfee': 'School Fee',
113        'clearance': 'Acceptance Fee',
114        'hostel_maintenance': 'Hostel Maintenance Fee',
[13750]115        'late_registration': 'Late Course Registration Fee',
116        'welfare': 'Student Welfare Assurance Fee',
117        'union': 'Student Union Dues',
118        'lapel': 'Lapel/File Fee',
119        'matric_gown': 'Matriculation Gown Fee',
[14234]120        'id_card': 'Student ID Card',
[14258]121        'gst_text_book_1': 'Text Book Fee GST101 GST102',
122        'gst_text_book_2': 'Text Book Fee GST111 GST112',
123        'gst_text_book_3': 'Text Book Fee GST222',
[14621]124        'ent_text_book_1': 'Text Book Fee ENT201',
[14258]125        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
126        'gst_registration_2': 'Registration Fee GST222',
[14620]127        'ent_registration_1': 'Registration Fee ENT201',
[14248]128        'fac_dep': 'Faculty and Departmental Dues',
[14375]129        'restitution': 'Restitution Fee',
[13638]130        }
131
[14544]132    PREVIOUS_PAYMENT_CATEGORIES = {
133        'schoolfee': 'School Fee',
134        'clearance': 'Acceptance Fee',
135        }
136
[10304]137    APP_CATS_DICT = {
138        'basic': 'PUTME, PUDE, PCE, PRENCE',
139        'no': 'No Application',
140        'pg_ft': 'Postgraduate Full-Time',
141        'pg_pt': 'Postgraduate Part-Time',
142        'cest': 'Part-Time, Diploma, Certificate',
143        'found': 'Foundation',
[10893]144        'ptee': 'Part-Time Entrance Examination',
[13568]145        'ioe_dp': 'Institute of Education Diploma',
[14339]146        'ijmbe': 'IJMBE Preparation',
[10304]147        }
148
[11591]149    STUDY_MODES_DICT = {
150        'ug_ft': 'Undergraduate Full Time',
151        'ug_pt': 'Undergraduate Part Time',
[11593]152        'de_ft': 'Direct Entry Full Time',
153        'de_pt': 'Direct Entry Part Time',
[11591]154        'dp_pt': 'Diploma Part Time',
155        'dp_ft': 'Diploma Full Time',
[13524]156        'special_pg_ft': 'Postgraduate Full Time',
157        'special_pg_pt': 'Postgraduate Part Time',
[11591]158        'found': 'Foundation',
[13498]159        'transfer': 'Transfer',
[13749]160        'mug_ft': 'Undergraduate Full Time Merit List',
161        'mde_ft': 'Direct Entry Full Time Merit List',
[14339]162        'ijmbe': 'IJMBE Preparation',
[11591]163        }
164
[14700]165    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
166
[13127]167    VERDICTS_DICT = {
168        '0': 'not yet',
169        'A': 'Successful student',
170        'B': 'Student with carryover courses',
171        'C': 'Student on probation',
[14475]172        'D': 'Withdrawn from the faculty',
[13127]173        #'E': 'Student who were previously on probation',
174        #'F': 'Medical case',
175        #'G': 'Absent from examination',
176        #'H': 'Withheld results',
177        #'I': 'Expelled/rusticated/suspended student',
178        #'J': 'Temporary withdrawn from the university',
179        #'K': 'Unregistered student',
180        #'L': 'Referred student',
181        #'M': 'Reinstatement',
182        #'N': 'Student on transfer',
183        #'O': 'NCE-III repeater',
184        #'Y': 'No previous verdict',
185        #'X': 'New 300 level student',
186        'Z': 'Successful student (provisional)',
187        #'A1': 'First Class',
188        #'A2': 'Second Class Upper',
189        #'A3': 'Second Class Lower',
190        #'A4': 'Third Class',
191        #'A5': 'Pass',
192        #'A6': 'Distinction',
193        #'A7': 'Credit',
194        #'A8': 'Merit',
[14487]195        'NER': 'No evidence of registration',
196        'NYV': 'Not yet verified',
[13127]197        'FRNS': 'Faculty requirements not satisfied',
198        }
[13454]199
200    DISABLE_PAYMENT_GROUP_DICT = {
201        'sf_all': 'School Fee - All Students',
[14246]202        'sf_pg': 'School Fee - Postgraduate Students',
[14571]203        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
[14246]204        'sf_found': 'School Fee - Foundation Students',
[13454]205        'maint_all': 'Accommodation Fee - All Students',
[13794]206        'cl_regular': 'Acceptance Fee - Regular Students',
[13454]207        }
[13870]208
209    MODE_GROUPS = {
210        'All': ('all',),
211        'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'),
212        'Undergraduate Part-Time': ('ug_pt', 'de_pt'),
213        'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'),
214        'Foundation Programme': ('found',),
215        'Institute of Education': ('dp_ft'),
216        }
[13963]217
218    def fullname(self, firstname, lastname, middlename=None):
219        """Construct fullname.
220        """
221        try:
222            lastname = lastname.upper()
223        except AttributeError:
224            pass
[14594]225        # We remove single initial
226        if firstname and len(firstname) == 1:
227            firstname = ''
228        if middlename and len(middlename) == 1:
229            middlename = ''
230        if lastname and len(lastname) == 1:
231            lastname = ''
232        # We construct givennames
233        givennames = ''
234        if middlename and firstname:
[13963]235            givennames = '%s %s' % (firstname, middlename)
[14594]236        elif firstname:
237            givennames = firstname
238        elif middlename:
239            givennames = middlename
[13963]240        givennames = string.capwords(
241            givennames.replace('-', ' - ')).replace(' - ', '-')
[14594]242        # We construct fullname
243        fullname = ''
244        if lastname and givennames:
245            fullname = '%s, %s' % (lastname, givennames)
246        elif lastname:
247            fullname = lastname
248        elif givennames:
249            fullname = givennames
[13963]250        if '<' in fullname:
251            return 'XXX'
252        return fullname
Note: See TracBrowser for help on using the repository browser.