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

Last change on this file since 16982 was 16952, checked in by Henrik Bettermann, 2 years ago

Rename exam fee.

  • Property svn:keywords set to Id
File size: 15.1 KB
RevLine 
[7569]1## $Id: utils.py 16952 2022-05-10 09:43:01Z 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
[15965]22import grok
[8823]23from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
[15451]24from waeup.kofa.students.workflow  import ALUMNI_STATES
[7569]25
[8823]26class CustomKofaUtils(NigeriaKofaUtils):
[7569]27    """A collection of methods subject to customization.
28    """
[7845]29
30    PREFERRED_LANGUAGES_DICT = {
[9755]31        }
32
[14650]33    COURSE_CATEGORY_DICT = {
34        'C':'Core Course (C)',
35        'R':'Required Courses (R)',
36        'E':'Elective Courses (E)',
37        }
38
[9755]39    PAYMENT_CATEGORIES = {
40        'schoolfee': 'School Fee',
[13512]41        'schoolfee_1': 'School Fee Plus (1st instalment)',
42        'schoolfee_2': 'School Fee (2nd instalment)',
[13410]43        'schoolfee_incl': 'School Fee Plus',
[9755]44        'clearance': 'Acceptance Fee',
[13410]45        'clearance_incl': 'Acceptance Fee Plus',
[13424]46        'hostel_maintenance': 'Hostel Accommodation Fee',
[9755]47        'application': 'Application Fee',
[15555]48        'app_balance': 'Application Fee Balance',
[9755]49        'bed_allocation': 'Bed Allocation Fee',
50        'transfer': 'Transfer Fee',
[14296]51        'transcript_local': 'Local Transcript Fee',
52        'transcript_inter': 'International Transcript Fee',
[13035]53        'late_registration': 'Late Course Registration Fee',
[13402]54        'welfare': 'Student Welfare Assurance Fee',
[13463]55        'union': 'Student Union Dues',
[13402]56        'lapel': 'Lapel/File Fee',
[13374]57        'matric_gown': 'Matriculation Gown Fee',
58        'concessional': 'Concessional Fee',
[14234]59        'id_card': 'Student ID Card',
[14355]60        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
61        'gst_text_book_1': 'Text Book Fee GST101 GST102',
62        'gst_text_book_2': 'Text Book Fee GST111 GST112',
[14258]63        'gst_text_book_3': 'Text Book Fee GST222',
[16754]64        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
65        'gst_registration_2': 'Registration Fee GST222',
[14621]66        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]67        'ent_text_book_2': 'Text Book Fee ENT211',
[16754]68        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
[14620]69        'ent_registration_1': 'Registration Fee ENT201',
[16749]70        'ent_registration_2': 'Registration Fee ENT211',
[16754]71        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
[16805]72        'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
[15841]73        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[16669]74        'ict': 'ICT/Affidavit Dues',
[16181]75        'affidavit': 'Affidavit Dues',
[14375]76        'restitution': 'Restitution Fee',
[15971]77        'sports': 'Sports Fee',
[16124]78        'library': 'UG Library Fee',
79        'library_pg': 'PG Library Fee',
80        'sports_library': 'Sports Development and Library Fee',
[16080]81        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
82        'lab_2': 'Laboratory Due (BIO101/BIO111)',
[16929]83        'lms_sund': 'LMS + Sundry Fees',
[16952]84        'exam': 'IJMBE Examination Fee',
[9755]85        }
86
87    SELECTABLE_PAYMENT_CATEGORIES = {
[13435]88        'schoolfee': 'School Fee without additional fees',
[15971]89        'schoolfee_1': 'School Fee (1st instalment) incl. additional fees',
[13512]90        'schoolfee_2': 'School Fee (2nd instalment)',
[15971]91        'schoolfee_incl': 'School Fee incl. additional fees',
[13435]92        'clearance': 'Acceptance Fee without additional fees',
[15971]93        'clearance_incl': 'Acceptance Fee incl. additional fees',
[13454]94        'hostel_maintenance': 'Hostel Accommodation Fee',
[14243]95        #'application': 'Application Fee',
[11621]96        #'bed_allocation': 'Bed Allocation Fee',
97        #'transfer': 'Transfer Fee',
[14296]98        'transcript_local': 'Local Transcript Fee',
99        'transcript_inter': 'International Transcript Fee',
[13035]100        'late_registration': 'Late Course Registration Fee',
[14243]101        #'welfare': 'Student Welfare Assurance Fee',
102        #'union': 'Student Union Dues',
103        #'lapel': 'Lapel/File Fee',
104        #'matric_gown': 'Matriculation Gown Fee',
[13374]105        'concessional': 'Concessional Fee',
[14243]106        #'id_card': 'Student ID Card',
[14355]107        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
108        'gst_text_book_1': 'Text Book Fee GST101 GST102',
109        'gst_text_book_2': 'Text Book Fee GST111 GST112',
[14258]110        'gst_text_book_3': 'Text Book Fee GST222',
[16754]111        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
112        'gst_registration_2': 'Registration Fee GST222',
[14621]113        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]114        'ent_text_book_2': 'Text Book Fee ENT211',
[16754]115        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
[14620]116        'ent_registration_1': 'Registration Fee ENT201',
[16749]117        'ent_registration_2': 'Registration Fee ENT211',
[16754]118        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
[16805]119        'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
[16177]120        #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[16669]121        'ict': 'ICT/Affidavit Dues',
122        #'affidavit': 'Affidavit Dues',
[14375]123        'restitution': 'Restitution Fee',
[16124]124        'sports': 'Sports Fee',
125        'library': 'UG Library Fee',
126        'library_pg': 'PG Library Fee',
127        'sports_library': 'Sports Development and Library Fee',
[16080]128        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
129        'lab_2': 'Laboratory Due (BIO101/BIO111)',
[16929]130        'lms_sund': 'LMS plus Sundry Fees (new UG students only)',
[9755]131        }
132
[15451]133    ALUMNI_PAYMENT_CATS =  {
134        'transcript_local': 'Transcript Fee Local',
135        'transcript_inter': 'Transcript Fee International',
136        }
137
138    REDUCED_PAYMENT_CATS =  {
139        'clearance': 'Acceptance Fee',
140        'schoolfee': 'School Fee',
[15465]141        'late_registration': 'Late Course Registration Fee',
[16124]142        'sports': 'Sports Fee',
143        'library': 'UG Library Fee',
144        'library_pg': 'PG Library Fee',
145        'sports_library': 'Sports Development and Library Fee',
[15451]146        }
147
148    IJMBE_PAYMENT_CATS =  {
149        'clearance': 'Acceptance Fee',
150        'schoolfee': 'School Fee',
151        'schoolfee_1': 'School Fee (1st instalment)',
152        'schoolfee_2': 'School Fee (2nd instalment)',
[16124]153        'sports': 'Sports Fee',
154        'library': 'UG Library Fee',
155        'library_pg': 'PG Library Fee',
156        'sports_library': 'Sports Development and Library Fee',
[16952]157        'exam': 'IJMBE Examination Fee',
[15451]158        }
159
160    PT_AND_DSH_PAYMENT_CATS =  {
161        'clearance_incl': 'Acceptance Fee Plus',
162        'schoolfee_incl': 'School Fee Plus',
[16754]163        'ent_text_book_1': 'Text Book Fee ENT201',
164        'ent_text_book_2': 'Text Book Fee ENT211',
165        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
[15451]166        'ent_registration_1': 'Registration Fee ENT201',
[16749]167        'ent_registration_2': 'Registration Fee ENT211',
[16754]168        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
[15451]169        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
170        'gst_registration_2': 'Registration Fee GST222',
171        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
172        'gst_text_book_1': 'Text Book Fee GST101 GST102',
173        'gst_text_book_2': 'Text Book Fee GST111 GST112',
174        'gst_text_book_3': 'Text Book Fee GST222',
[16805]175        'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
[15862]176        'late_registration': 'Late Course Registration Fee',
[16124]177        'sports': 'Sports Fee',
178        'library': 'UG Library Fee',
179        'library_pg': 'PG Library Fee',
180        'sports_library': 'Sports Development and Library Fee',
[16080]181        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
182        'lab_2': 'Laboratory Due (BIO101/BIO111)',
[15451]183        }
184
[15433]185    def selectable_payment_categories(self, student):
[15451]186        if student.state in ALUMNI_STATES:
187            return self.ALUMNI_PAYMENT_CATS
188        if student.current_mode in (
189            'special_pg_ft', 'special_pg_pt', 'found', 'bridge'):
190            return self.REDUCED_PAYMENT_CATS
191        if student.current_mode in (
192            'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
193            return self.PT_AND_DSH_PAYMENT_CATS
194        if student.current_mode == 'ijmbe':
195            return self.IJMBE_PAYMENT_CATS
[15433]196        return self.SELECTABLE_PAYMENT_CATEGORIES
197
[13451]198    REPORTABLE_PAYMENT_CATEGORIES = {
199        'schoolfee': 'School Fee',
[13452]200        'schoolfee_incl': 'School Fee Plus',
[13635]201        'schoolfee_1': 'School Fee 1 Plus',
202        'schoolfee_2': 'School Fee 2',
[13451]203        'clearance': 'Acceptance Fee',
[13452]204        'clearance_incl': 'Acceptance Fee Plus',
[13451]205        'hostel_maintenance': 'Hostel Maintenance Fee',
206        }
207
[13638]208    BALANCE_PAYMENT_CATEGORIES = {
209        'schoolfee': 'School Fee',
210        'clearance': 'Acceptance Fee',
211        'hostel_maintenance': 'Hostel Maintenance Fee',
[13750]212        'late_registration': 'Late Course Registration Fee',
213        'welfare': 'Student Welfare Assurance Fee',
214        'union': 'Student Union Dues',
215        'lapel': 'Lapel/File Fee',
216        'matric_gown': 'Matriculation Gown Fee',
[14234]217        'id_card': 'Student ID Card',
[14258]218        'gst_text_book_1': 'Text Book Fee GST101 GST102',
219        'gst_text_book_2': 'Text Book Fee GST111 GST112',
220        'gst_text_book_3': 'Text Book Fee GST222',
[16754]221        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
222        'gst_registration_2': 'Registration Fee GST222',
[14621]223        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]224        'ent_text_book_2': 'Text Book Fee ENT211',
[16754]225        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
[14620]226        'ent_registration_1': 'Registration Fee ENT201',
[16749]227        'ent_registration_2': 'Registration Fee ENT211',
[16754]228        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
[16179]229        #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[16669]230        'ict': 'ICT/Affidavit Dues',
231        #'affidavit': 'Affidavit Dues',
[14375]232        'restitution': 'Restitution Fee',
[13638]233        }
234
[14544]235    PREVIOUS_PAYMENT_CATEGORIES = {
236        'schoolfee': 'School Fee',
237        'clearance': 'Acceptance Fee',
[16552]238        'late_registration': 'Late Course Registration Fee',
[14544]239        }
240
[10304]241    APP_CATS_DICT = {
242        'basic': 'PUTME, PUDE, PCE, PRENCE',
243        'no': 'No Application',
244        'pg_ft': 'Postgraduate Full-Time',
245        'pg_pt': 'Postgraduate Part-Time',
246        'cest': 'Part-Time, Diploma, Certificate',
247        'found': 'Foundation',
[10893]248        'ptee': 'Part-Time Entrance Examination',
[13568]249        'ioe_dp': 'Institute of Education Diploma',
[14339]250        'ijmbe': 'IJMBE Preparation',
[15224]251        'bridge': 'Bridge',
[15385]252        'dsh': 'Science and Humanities',
253
[10304]254        }
255
[11591]256    STUDY_MODES_DICT = {
257        'ug_ft': 'Undergraduate Full Time',
258        'ug_pt': 'Undergraduate Part Time',
[11593]259        'de_ft': 'Direct Entry Full Time',
260        'de_pt': 'Direct Entry Part Time',
[11591]261        'dp_pt': 'Diploma Part Time',
262        'dp_ft': 'Diploma Full Time',
[13524]263        'special_pg_ft': 'Postgraduate Full Time',
264        'special_pg_pt': 'Postgraduate Part Time',
[11591]265        'found': 'Foundation',
[13498]266        'transfer': 'Transfer',
[16830]267        'transferred': 'Transferred',
[13749]268        'mug_ft': 'Undergraduate Full Time Merit List',
269        'mde_ft': 'Direct Entry Full Time Merit List',
[14339]270        'ijmbe': 'IJMBE Preparation',
[15217]271        'bridge': 'Bridge',
[15382]272        'ug_dsh': 'Undergraduate Science and Humanities',
273        'de_dsh': 'Direct Entry Science and Humanities',
[11591]274        }
275
[14700]276    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
277
[13127]278    VERDICTS_DICT = {
279        '0': 'not yet',
280        'A': 'Successful student',
281        'B': 'Student with carryover courses',
282        'C': 'Student on probation',
[14475]283        'D': 'Withdrawn from the faculty',
[13127]284        #'E': 'Student who were previously on probation',
285        #'F': 'Medical case',
286        #'G': 'Absent from examination',
287        #'H': 'Withheld results',
288        #'I': 'Expelled/rusticated/suspended student',
289        #'J': 'Temporary withdrawn from the university',
290        #'K': 'Unregistered student',
291        #'L': 'Referred student',
292        #'M': 'Reinstatement',
293        #'N': 'Student on transfer',
294        #'O': 'NCE-III repeater',
295        #'Y': 'No previous verdict',
296        #'X': 'New 300 level student',
297        'Z': 'Successful student (provisional)',
298        #'A1': 'First Class',
299        #'A2': 'Second Class Upper',
300        #'A3': 'Second Class Lower',
301        #'A4': 'Third Class',
302        #'A5': 'Pass',
303        #'A6': 'Distinction',
304        #'A7': 'Credit',
305        #'A8': 'Merit',
[14487]306        'NER': 'No evidence of registration',
307        'NYV': 'Not yet verified',
[13127]308        'FRNS': 'Faculty requirements not satisfied',
309        }
[13454]310
311    DISABLE_PAYMENT_GROUP_DICT = {
312        'sf_all': 'School Fee - All Students',
[14246]313        'sf_pg': 'School Fee - Postgraduate Students',
[14571]314        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
[14246]315        'sf_found': 'School Fee - Foundation Students',
[13454]316        'maint_all': 'Accommodation Fee - All Students',
[13794]317        'cl_regular': 'Acceptance Fee - Regular Students',
[13454]318        }
[13870]319
320    MODE_GROUPS = {
321        'All': ('all',),
322        'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'),
323        'Undergraduate Part-Time': ('ug_pt', 'de_pt'),
324        'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'),
325        'Foundation Programme': ('found',),
326        'Institute of Education': ('dp_ft'),
[15242]327        'IJMBE Preparation': ('ijmbe',),
328        'Bridge': ('bridge',),
[13870]329        }
[13963]330
[15431]331    #: Maximum number of files listed in `finished` subfolder
332    MAX_FILES = 5000
333
[13963]334    def fullname(self, firstname, lastname, middlename=None):
335        """Construct fullname.
336        """
337        try:
338            lastname = lastname.upper()
339        except AttributeError:
340            pass
[14594]341        # We remove single initial
342        if firstname and len(firstname) == 1:
343            firstname = ''
344        if middlename and len(middlename) == 1:
345            middlename = ''
346        if lastname and len(lastname) == 1:
347            lastname = ''
348        # We construct givennames
349        givennames = ''
350        if middlename and firstname:
[13963]351            givennames = '%s %s' % (firstname, middlename)
[14594]352        elif firstname:
353            givennames = firstname
354        elif middlename:
355            givennames = middlename
[13963]356        givennames = string.capwords(
357            givennames.replace('-', ' - ')).replace(' - ', '-')
[14594]358        # We construct fullname
359        fullname = ''
360        if lastname and givennames:
361            fullname = '%s, %s' % (lastname, givennames)
362        elif lastname:
363            fullname = lastname
364        elif givennames:
365            fullname = givennames
[13963]366        if '<' in fullname:
367            return 'XXX'
368        return fullname
[15965]369
370    def getUsers(self):
371        users = sorted(
372            grok.getSite()['users'].items(), key=lambda x: x[0])
373        for key, val in users:
374            yield(dict(name=key, val="%s - %s" % (val.name, val.title)))
Note: See TracBrowser for help on using the repository browser.