source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/utils/utils.py @ 14780

Last change on this file since 14780 was 13945, checked in by Henrik Bettermann, 9 years ago

PUTME is obsolete (at least at Uniben). Rename putme to ase (Admission Screening Exercise).

  • Property svn:keywords set to Id
File size: 11.8 KB
RevLine 
[8810]1## $Id: utils.py 13945 2016-06-15 10:55:25Z 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##
18"""Customize general helper utilities for Kofa.
19"""
20import os
21import pytz
22from waeup.kofa.utils.utils import KofaUtils, sorted_phone_prefixes
23from kofacustom.nigeria.interfaces import MessageFactory as _
[13618]24from kofacustom.nigeria.utils.degrees import DEGREES_DICT
[8810]25
26INT_PHONE_PREFIXES = [
27    (1, _('Nigeria'), '234'),
28    (99, _('Germany'), '49'),
29    (99, _('United States'), '1'),
30    (99, _('Niger'), '227'),
31    (99, _('Benin'), '229'),
32    (99, _('Cameroon'), '237'),
33    (99, _('United Kingdom'), '44'),
34    (99, _('France'), '33'),
35    ]
36
[8817]37class NigeriaKofaUtils(KofaUtils):
[8810]38    """A collection of methods subject to customization.
39    """
40    PORTAL_LANGUAGE = 'en'
41
42    PREFERRED_LANGUAGES_DICT = {
43        'en':(1, u'English'),
44        'fr':(2, u'Français'),
45        'de':(3, u'Deutsch'),
46        'ha':(4, u'Hausa'),
47        'yo':(5, u'Yoruba'),
48        'ig':(6, u'Igbo'),
49        }
50
51    #: A function to return
52    @classmethod
53    def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None):
54        return sorted_phone_prefixes(data, request)
55
[13618]56    DEGREES_DICT = DEGREES_DICT
57
[8810]58    EXAM_SUBJECTS_DICT = {
59        'accounts': 'Accounts',
60        'add_general_science': 'Add General Science',
61        'add_maths': 'Add Maths',
62        'adv_elect_install_maint': 'Adv. Electrical Installation and Maintenance',
63        'agricultural_science': 'Agricultural Science',
64        'applied_electricity': 'Applied Electricity',
65        'arabi': 'Arabic',
66        'arithmetics': 'Arithmetics',
67        'art': 'Art',
68        'auto_mechanics': 'Auto Mechanics',
[10997]69        'awaiting_results': 'Awaiting Results',
[8810]70        'basic_electricity': 'Basic Electricity',
71        'bible_knowledge': 'Bible Knowledge',
72        'biology': 'Biology',
73        'biology_alt_syl': 'Biology (Alt.Syl)',
[13531]74        'block_brick_concrete': 'Block Laying, Brick Laying and Concreting',
[8810]75        'book_keeping': 'Book Keeping',
76        'building_construction': 'Building Construction',
77        'business_management': 'Business Management',
78        'business_construction_management': 'Business/Construction Management (Adv)',
79        'chemistry': 'Chemistry',
80        'chemistry_alt_syl': 'Chemistry (Alt.Syl)',
81        'christian_religious_studies': 'Christian Religious Studies',
82        'class_teaching': 'Class Teaching',
83        'clerical_office_duties': 'Clerical Office Duties',
84        'clothing_and_textiles': 'Clothing and Textiles',
85        'commerce': 'Commerce',
86        'economics': 'Economics',
[13666]87        'edo': 'Edo Language',
[8810]88        'education': 'Education',
89        'efik': 'Efik',
90        'electronics': 'Electronics',
91        'elementary_surveying': 'Elementary Surveying',
92        'english_language': 'English Language',
93        'engineering_science': 'Engineering Science',
94        'financial_accounting': 'Financial Accounting',
[13160]95        'fine_art': 'Fine Art',
[8810]96        'food_and_nutrition': 'Food and Nutrition',
97        'french': 'French',
98        'further_mathematics': 'Further Mathematics',
99        'general_science': 'General Science',
100        'geography': 'Geography',
101        'german': 'German',
102        'government': 'Government',
103        'hausa': 'Hausa',
104        'hausa_literature': 'Hausa Literature',
105        'health_science': 'Health Science',
106        'history': 'History',
[13160]107        'home_economics': 'Home Economics',
[8810]108        'home_management': 'Home Management',
109        'human_biology': 'Human Biology',
110        'industrial_electrical_installation': 'Industrial Elect Installation (Adv)',
111        'intergrated_science': 'Intergrated Science',
112        'islamic_studies': 'Islamic Studies',
113        'literature_in_english': 'Literature in English',
114        'literature_in_nigerian_languages': 'Literature in Nigerian Languages',
115        'igbo': 'Igbo',
116        'igbo_literature': 'Igbo Literature',
117        'yoruba': 'Yoruba',
118        'yoruba_literature': 'Yoruba Literature',
119        'management_in_living': 'Management in Living',
120        'mathematics': 'Mathematics',
121        'metalwork': 'Metalwork',
122        'music': 'Music',
123        'nigerian_language': 'Nigerian Language',
124        'office_practice': 'Office Practice',
125        'physical_education': 'Physical Education',
126        'physical_health_education': 'Physical and Health Education',
127        'physics': 'Physics',
128        'physics_alt_syl': 'Physics (Alt.Syl)',
129        'principles_and_practice_of_education': 'Principles and Practice of Education',
130        'principles_of_cost_accounting': 'Principles of Cost Accounting',
131        'rural_science': 'Rural Science',
132        'science': 'Science',
133        'secretarial_duties': 'Secretarial Duties',
134        'shorthand': 'Shorthand',
135        'sierra_leone_studies': 'Sierra Leone Studies',
136        'sierra_leone_languages': 'Sierra Leone Languages',
137        'social_studies': 'Social Studies',
138        'statistics': 'Statistics',
139        'teaching_practice': 'Teaching Practice',
140        'technical_drawing': 'Technical Drawing',
141        'typewriting': 'Typewriting',
142        'visual_art': 'Visual Art',
143        'woodwork': 'Woodwork',
[11549]144        'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc',
145        'first_written': 'First Written',
146        'second_written': 'Second Written',
147        'pract_tests': 'Practical Tests',
[11780]148        # Added 25/08/2014
149        'animal_husbandry_(alt_a)': 'Animal Husbandry (Alt A)',
150        'animal_husbandry_(alt_b)': 'Animal Husbandry (Alt B)',
151        'auto_electrical_work': 'Auto Electrical Work',
152        'auto_mechanical_work': 'Auto Mechanical Work',
153        'catering_craft_practice': 'Catering Craft Practice',
154        'civic_education': 'Civic Education',
155        'computer_studies': 'Computer Studies',
156        'cosmetology': 'Cosmetology',
157        'data_processing': 'Data Processing',
158        'dyeing_&_bleaching': 'Dyeing & Bleaching',
159        'electrical_installation_and_maintenance_work': 'Electrical Installation and Maintenance Work',
160        'fisheries_(alt_a)_ghana_candidates': 'Fisheries (Alt A) Ghana Candidates',
161        'fisheries_(alt_b)_nigeria_candidates': 'Fisheries (Alt B) Nigeria Candidates',
162        'garment_making': 'Garment Making',
163        'general_agriculture': 'General Agriculture',
164        'gsm_phones_maintenance_and_repairs': 'Gsm Phones Maintenance and Repairs',
165        'health_education': 'Health Education',
166        'insurance': 'Insurance',
167        'painting_and_decorating': 'Painting and Decorating',
168        'photography': 'Photography',
169        'printing_craft_practice': 'Printing Craft Practice',
170        'store_management': 'Store Management',
171        'textiles': 'Textiles',
[12613]172        # Added after 19/01/2015
[12495]173        'marketing': 'Marketing',
174        'carpentry_joinery': 'Carpentry and Joinery',
[12505]175        'tourism': 'Tourism',
[12551]176        'mining': 'Mining',
[12613]177        'furniture_making': 'Furniture Making',
[13343]178        'information_communication_technology': 'Information and Communication Technology',
[13433]179        'salesmanship': 'Salesmanship',
[13703]180        'welding_and_fabrication': 'Welding and Fabrication',
[8810]181        }
182
183    EXAM_GRADES = (
184        ('A1', 'Excellent (A1)'),
185        ('A2', 'Very Good (A2)'),
186        ('A3', 'Good (A3)'),
187        ('B2', 'Very Good (B2)'),
188        ('B3', 'Good (B3)'),
189        ('C4', 'Credit (C4)'),
190        ('C5', 'Credit (C5)'),
191        ('C6', 'Credit (C6)'),
192        ('A', 'Pass (A)'),
193        ('B', 'Pass (B)'),
194        ('C', 'Pass (C)'),
195        ('U', 'Pass (U)'),
196        ('D7', 'Pass (D7)'),
197        ('P7', 'Pass (P7)'),
198        ('P8', 'Pass (P8)'),
199        ('E8', 'Pass (E8)'),
200        ('F9', 'Fail (F9)'),
201        ('Aa', 'A (a)'),
202        ('Bb', 'B (b)'),
203        ('Cc', 'C (c)'),
204        ('Dd', 'D (d)'),
205        ('Ee', 'E (e)'),
206        ('Ff', 'F (f)'),
[10997]207        ('Gg', 'G (g)'),
[11587]208        ('credit-1', 'Credit-1'),
209        ('credit-2', 'Credit-2'),
210        ('dist', 'Distinction'),
211        ('pass', 'Pass'), 
[10997]212        ('AR', 'Awaiting Results'),
[8810]213        )
214
215    INST_TYPES_DICT = {
216        'none': '',
217        'faculty': 'Faculty of',
218        'department': 'Department of',
219        'school': 'School of',
220        'office': 'Office for',
221        'centre': 'Centre for',
222        'institute': 'Institute of',
223        'school_for': 'School for',
224        'college': 'College of',
[10303]225        'directorate': 'Directorate of',
[8810]226        }
227
228    STUDY_MODES_DICT = {
[9230]229        'ume_ft': 'UME Full Time',
[8934]230        'ug_ft': 'Undergraduate Full Time',
231        'ug_pt': 'Undergraduate Part Time',
[8810]232        'dp_pt': 'Diploma Part Time',
233        'ct_ft': 'Certificate Full Time',
234        'dp_ft': 'Diploma Full Time',
[8934]235        'de_ft': 'Direct Entry Full Time',
[8810]236        'de_pt': 'Direct Entry Part Time',
[9349]237        'nd_ft': 'National Diploma Full Time',
238        'nd_pt': 'National Diploma Part Time',
239        'hnd_ft': 'Higher National Diploma Full Time',
240        'hnd_pt': 'Higher National Diploma Part Time',
[8810]241        'pg_ft': 'Postgraduate Full Time',
242        'pg_pt': 'Postgraduate Part Time',
[9349]243        'pgd_ft': 'Postgraduate Diploma Full Time',
244        'pgd_pt': 'Postgraduate Diploma Part Time',
[10156]245        'special_pg_pt': 'Special Postgraduate Part Time',
[9941]246        'nce_ft': 'NCE Full Time',
247        'nce_pt': 'NCE Part Time',
[8934]248        'ug_sw': 'Undergraduate Sandwich',
[9942]249        'nce_sw': 'NCE Sandwich',
[8810]250        'jm_ft': 'Joint Matriculation Full Time',
251        'ph_ft': 'Post Higher Education Full Time',
252        'transfer_pt': 'Transfer Part Time',
253        'transfer_ft': 'Transfer Full Time',
254        'ct_pt': 'Certificate Part Time',
[8934]255        'rmd_ft': 'Remedial with deficiencies',
[9144]256        'rm_ft': 'Remedial',
[9163]257        'transfer': 'Transfer',
258        'prence': 'Pre-NCE',
[9349]259        'prend': 'Pre-ND',
[9164]260        'pce': 'PCE',
[9165]261        'pd_ft': 'Professional Diploma in Education',
[10892]262        'found': 'Foundation',
[10087]263        'no': 'no application',
[8810]264        }
265
266    APP_CATS_DICT = {
[13945]267        'basic': 'UAS, PUTME, PUDE, PCE, PRENCE',
[9085]268        'no': 'No Application',
[8810]269        'pg_ft': 'Postgraduate Full-Time',
270        'pg_pt': 'Postgraduate Part-Time',
271        'sandwich': 'Sandwich',
[9085]272        'cest': 'Part-Time, Diploma, Certificate',
[13142]273        'pre': 'Pre-Degree Studies',
[8810]274        }
275
[13126]276    VERDICTS_DICT = {
277        '0': 'not yet',
278        'A': 'Successful student',
279        'B': 'Student with carryover courses',
280        'C': 'Student on probation',
281        'D': 'Withdrawn from the faculty',
282        'E': 'Student who were previously on probation',
283        'F': 'Medical case',
284        'G': 'Absent from examination',
285        'H': 'Withheld results',
286        'I': 'Expelled/rusticated/suspended student',
287        'J': 'Temporary withdrawn from the university',
288        'K': 'Unregistered student',
289        'L': 'Referred student',
290        'M': 'Reinstatement',
291        'N': 'Student on transfer',
292        #'O': 'NCE-III repeater', # FCEOkene only
293        'P': 'Exhausted maximum years in the university',
294        'Y': 'No previous verdict',
295        'X': 'New 300 level student (Uniben)',
296        'Z': 'Successful student (provisional)',
297        'A1': 'First Class',
298        'A2': 'Second Class Upper',
299        'A3': 'Second Class Lower',
300        'A4': 'Third Class',
301        'A5': 'Pass',
302        'A6': 'Distinction',
303        'A7': 'Credit',
304        'A8': 'Merit',
305        }
306
307
[8810]308    @property
309    def tzinfo(self):
310        return pytz.timezone('Africa/Lagos')
Note: See TracBrowser for help on using the repository browser.