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

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

Add p_currency field.

  • Property svn:keywords set to Id
File size: 13.7 KB
Line 
1## $Id: utils.py 17246 2022-12-28 09:57:26Z 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 _
24from kofacustom.nigeria.utils.degrees import DEGREES_DICT
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    (99, _('Australia'), '61'),
36    (99, _('Austria'), '43'),
37    (99, _('Canada'), '1'),
38    (99, _('China'), '86'),
39    (99, _('Cyprus'), '357'),
40    (99, _('Denmark'), '45'),
41    (99, _('Egypt'), '20'),
42    (99, _('Estonia'), '372'),
43    (99, _('Ethiopia'), '251'),
44    (99, _('Finland'), '358'),
45    (99, _('Gambia'), '220'),
46    (99, _('Georgia'), '995'),
47    (99, _('Ghana'), '233'),
48    (99, _('Greece'), '30'),
49    (99, _('Hong Kong'), '852'),
50    (99, _('Hungary'), '36'),
51    (99, _('Iceland'), '354'),
52    (99, _('India'), '91'),
53    (99, _('Ireland'), '353'),
54    (99, _('Italy'), '39'),
55    (99, _('Japan'), '81'),
56    (99, _('Kenya'), '254'),
57    (99, _('Luxembourg'), '352'),
58    (99, _('Malaysia'), '60'),
59    (99, _('Malta'), '356'),
60    (99, _('Netherlands'), '31'),
61    (99, _('New Zealand'), '64'),
62    (99, _('Norway'), '47'),
63    (99, _('Qatar'), '974'),
64    (99, _('South Africa'), '27'),
65    (99, _('Spain'), '34'),
66    (99, _('Sweden'), '46'),
67    (99, _('Switzerland'), '41'),
68    (99, _('Togo'), '228'),
69    (99, _('Turkey'), '90'),
70    (99, _('Ukraine'), '380'),
71    (99, _('United Arab Emirates'), '971'),
72    (99, _('Zambia'), '260'),
73    (99, _('Zimbabwe'), '263'),
74    ]
75
76class NigeriaKofaUtils(KofaUtils):
77    """A collection of methods subject to customization.
78    """
79    PORTAL_LANGUAGE = 'en'
80
81    PREFERRED_LANGUAGES_DICT = {
82        'en':(1, u'English'),
83        'fr':(2, u'Français'),
84        'de':(3, u'Deutsch'),
85        'ha':(4, u'Hausa'),
86        'yo':(5, u'Yoruba'),
87        'ig':(6, u'Igbo'),
88        }
89
90    #: A function to return
91    @classmethod
92    def sorted_phone_prefixes(cls, data=INT_PHONE_PREFIXES, request=None):
93        return sorted_phone_prefixes(data, request)
94
95    DEGREES_DICT = DEGREES_DICT
96
97    EXAM_SUBJECTS_DICT = {
98        'accounts': 'Accounts',
99        'add_general_science': 'Add General Science',
100        'add_maths': 'Add Maths',
101        'adv_elect_install_maint': 'Adv. Electrical Installation and Maintenance',
102        'agricultural_science': 'Agricultural Science',
103        'applied_electricity': 'Applied Electricity',
104        'arabi': 'Arabic',
105        'arithmetics': 'Arithmetics',
106        'art': 'Art',
107        'auto_mechanics': 'Auto Mechanics',
108        'awaiting_results': 'Awaiting Results',
109        'basic_electricity': 'Basic Electricity',
110        'bible_knowledge': 'Bible Knowledge',
111        'biology': 'Biology',
112        'biology_alt_syl': 'Biology (Alt.Syl)',
113        'block_brick_concrete': 'Block Laying, Brick Laying and Concreting',
114        'book_keeping': 'Book Keeping',
115        'building_construction': 'Building Construction',
116        'business_management': 'Business Management',
117        'business_construction_management': 'Business/Construction Management (Adv)',
118        'chemistry': 'Chemistry',
119        'chemistry_alt_syl': 'Chemistry (Alt.Syl)',
120        'christian_religious_studies': 'Christian Religious Studies',
121        'class_teaching': 'Class Teaching',
122        'clerical_office_duties': 'Clerical Office Duties',
123        'clothing_and_textiles': 'Clothing and Textiles',
124        'commerce': 'Commerce',
125        'economics': 'Economics',
126        'edo': 'Edo Language',
127        'education': 'Education',
128        'efik': 'Efik',
129        'electronics': 'Electronics',
130        'elementary_surveying': 'Elementary Surveying',
131        'english_language': 'English Language',
132        'engineering_science': 'Engineering Science',
133        'financial_accounting': 'Financial Accounting',
134        'fine_art': 'Fine Art',
135        'food_and_nutrition': 'Food and Nutrition',
136        'french': 'French',
137        'further_mathematics': 'Further Mathematics',
138        'general_science': 'General Science',
139        'geography': 'Geography',
140        'german': 'German',
141        'government': 'Government',
142        'hausa': 'Hausa',
143        'hausa_literature': 'Hausa Literature',
144        'health_science': 'Health Science',
145        'history': 'History',
146        'home_economics': 'Home Economics',
147        'home_management': 'Home Management',
148        'human_biology': 'Human Biology',
149        'industrial_electrical_installation': 'Industrial Elect Installation (Adv)',
150        'intergrated_science': 'Intergrated Science',
151        'islamic_studies': 'Islamic Studies',
152        'literature_in_english': 'Literature in English',
153        'literature_in_nigerian_languages': 'Literature in Nigerian Languages',
154        'igbo': 'Igbo',
155        'igbo_literature': 'Igbo Literature',
156        'yoruba': 'Yoruba',
157        'yoruba_literature': 'Yoruba Literature',
158        'management_in_living': 'Management in Living',
159        'mathematics': 'Mathematics',
160        'metalwork': 'Metalwork',
161        'music': 'Music',
162        'nigerian_language': 'Nigerian Language',
163        'office_practice': 'Office Practice',
164        'physical_education': 'Physical Education',
165        'physical_health_education': 'Physical and Health Education',
166        'physics': 'Physics',
167        'physics_alt_syl': 'Physics (Alt.Syl)',
168        'principles_and_practice_of_education': 'Principles and Practice of Education',
169        'principles_of_cost_accounting': 'Principles of Cost Accounting',
170        'rural_science': 'Rural Science',
171        'science': 'Science',
172        'secretarial_duties': 'Secretarial Duties',
173        'shorthand': 'Shorthand',
174        'sierra_leone_studies': 'Sierra Leone Studies',
175        'sierra_leone_languages': 'Sierra Leone Languages',
176        'social_studies': 'Social Studies',
177        'statistics': 'Statistics',
178        'teaching_practice': 'Teaching Practice',
179        'technical_drawing': 'Technical Drawing',
180        'typewriting': 'Typewriting',
181        'visual_art': 'Visual Art',
182        'woodwork': 'Woodwork',
183        'winding_elect_machines': 'Winding of Elect Machines and Elect Eng Sc',
184        'first_written': 'First Written',
185        'second_written': 'Second Written',
186        'pract_tests': 'Practical Tests',
187        # Added 25/08/2014
188        'animal_husbandry_(alt_a)': 'Animal Husbandry (Alt A)',
189        'animal_husbandry_(alt_b)': 'Animal Husbandry (Alt B)',
190        'auto_electrical_work': 'Auto Electrical Work',
191        'auto_mechanical_work': 'Auto Mechanical Work',
192        'catering_craft_practice': 'Catering Craft Practice',
193        'civic_education': 'Civic Education',
194        'computer_studies': 'Computer Studies',
195        'cosmetology': 'Cosmetology',
196        'data_processing': 'Data Processing',
197        'dyeing_&_bleaching': 'Dyeing & Bleaching',
198        'electrical_installation_and_maintenance_work': 'Electrical Installation and Maintenance Work',
199        'fisheries_(alt_a)_ghana_candidates': 'Fisheries (Alt A) Ghana Candidates',
200        'fisheries_(alt_b)_nigeria_candidates': 'Fisheries (Alt B) Nigeria Candidates',
201        'garment_making': 'Garment Making',
202        'general_agriculture': 'General Agriculture',
203        'gsm_phones_maintenance_and_repairs': 'Gsm Phones Maintenance and Repairs',
204        'health_education': 'Health Education',
205        'insurance': 'Insurance',
206        'painting_and_decorating': 'Painting and Decorating',
207        'photography': 'Photography',
208        'printing_craft_practice': 'Printing Craft Practice',
209        'store_management': 'Store Management',
210        'textiles': 'Textiles',
211        # Added after 19/01/2015
212        'marketing': 'Marketing',
213        'carpentry_joinery': 'Carpentry and Joinery',
214        'tourism': 'Tourism',
215        'mining': 'Mining',
216        'furniture_making': 'Furniture Making',
217        'information_communication_technology': 'Information and Communication Technology',
218        'salesmanship': 'Salesmanship',
219        'welding_and_fabrication': 'Welding and Fabrication',
220        }
221
222    EXAM_GRADES = (
223        ('A1', 'Excellent (A1)'),
224        ('A2', 'Very Good (A2)'),
225        ('A3', 'Good (A3)'),
226        ('B2', 'Very Good (B2)'),
227        ('B3', 'Good (B3)'),
228        ('C4', 'Credit (C4)'),
229        ('C5', 'Credit (C5)'),
230        ('C6', 'Credit (C6)'),
231        ('A', 'Pass (A)'),
232        ('B', 'Pass (B)'),
233        ('C', 'Pass (C)'),
234        ('U', 'Pass (U)'),
235        ('D7', 'Pass (D7)'),
236        ('P7', 'Pass (P7)'),
237        ('P8', 'Pass (P8)'),
238        ('E8', 'Pass (E8)'),
239        ('F9', 'Fail (F9)'),
240        ('Aa', 'A (a)'),
241        ('Bb', 'B (b)'),
242        ('Cc', 'C (c)'),
243        ('Dd', 'D (d)'),
244        ('Ee', 'E (e)'),
245        ('Ff', 'F (f)'),
246        ('Gg', 'G (g)'),
247        ('credit-1', 'Credit-1'),
248        ('credit-2', 'Credit-2'),
249        ('dist', 'Distinction'),
250        ('pass', 'Pass'), 
251        ('AR', 'Awaiting Results'),
252        )
253
254    INST_TYPES_DICT = {
255        'none': '',
256        'faculty': 'Faculty of',
257        'department': 'Department of',
258        'school': 'School of',
259        'office': 'Office for',
260        'centre': 'Centre for',
261        'centre_of': 'Centre of',
262        'institute': 'Institute of',
263        'school_for': 'School for',
264        'college': 'College of',
265        'directorate': 'Directorate of',
266        }
267
268    STUDY_MODES_DICT = {
269        'ume_ft': 'UME Full Time',
270        'ug_ft': 'Undergraduate Full Time',
271        'ug_pt': 'Undergraduate Part Time',
272        'dp_pt': 'Diploma Part Time',
273        'ct_ft': 'Certificate Full Time',
274        'dp_ft': 'Diploma Full Time',
275        'de_ft': 'Direct Entry Full Time',
276        'de_pt': 'Direct Entry Part Time',
277        'nd_ft': 'National Diploma Full Time',
278        'nd_pt': 'National Diploma Part Time',
279        'hnd_ft': 'Higher National Diploma Full Time',
280        'hnd_pt': 'Higher National Diploma Part Time',
281        'pg_ft': 'Postgraduate Full Time',
282        'pg_pt': 'Postgraduate Part Time',
283        'pgd_ft': 'Postgraduate Diploma Full Time',
284        'pgd_pt': 'Postgraduate Diploma Part Time',
285        'pgphd': 'Postgraduate PhD/MPhil',
286        'special_pg_pt': 'Special Postgraduate Part Time',
287        'nce_ft': 'NCE Full Time',
288        'nce_pt': 'NCE Part Time',
289        'ug_sw': 'Undergraduate Sandwich',
290        'nce_sw': 'NCE Sandwich',
291        'jm_ft': 'Joint Matriculation Full Time',
292        'ph_ft': 'Post Higher Education Full Time',
293        'transfer_pt': 'Transfer Part Time',
294        'transfer_ft': 'Transfer Full Time',
295        'ct_pt': 'Certificate Part Time',
296        'rmd_ft': 'Remedial with deficiencies',
297        'rm_ft': 'Remedial',
298        'transfer': 'Transfer',
299        'prence': 'Pre-NCE',
300        'prend': 'Pre-ND',
301        'pce': 'PCE',
302        'pd_ft': 'Professional Diploma in Education',
303        'found': 'Foundation',
304        'no': 'no application',
305        }
306
307    APP_CATS_DICT = {
308        'basic': 'UAS, PUTME, PUDE, PCE, PRENCE',
309        'no': 'No Application',
310        'pg_ft': 'Postgraduate Full-Time',
311        'pg_pt': 'Postgraduate Part-Time',
312        'sandwich': 'Sandwich',
313        'cest': 'Part-Time, Diploma, Certificate',
314        'pre': 'Pre-Degree Studies',
315        }
316
317    VERDICTS_DICT = {
318        '0': 'not yet',
319        'A': 'Successful student',
320        'B': 'Student with carryover courses',
321        'C': 'Student on probation',
322        'D': 'Withdrawn from the faculty',
323        'E': 'Student who were previously on probation',
324        'F': 'Medical case',
325        'G': 'Absent from examination',
326        'H': 'Withheld results',
327        'I': 'Expelled/rusticated/suspended student',
328        'J': 'Temporary withdrawn from the university',
329        'K': 'Unregistered student',
330        'L': 'Referred student',
331        'M': 'Reinstatement',
332        'N': 'Student on transfer',
333        #'O': 'NCE-III repeater', # FCEOkene only
334        'P': 'Exhausted maximum years in the university',
335        'R': 'Register Excess Credit',
336        'Y': 'No previous verdict',
337        'X': 'New 300 level student (Uniben)',
338        'Z': 'Successful student (provisional)',
339        'A1': 'First Class',
340        'A2': 'Second Class Upper',
341        'A3': 'Second Class Lower',
342        'A4': 'Third Class',
343        'A5': 'Pass',
344        'A6': 'Distinction',
345        'A7': 'Credit',
346        'A8': 'Merit',
347        'A9': 'Cert Not Classified',
348        'A10': 'Upper Credit',
349        'A11': 'Lower Credit',
350        }
351
352    DISABILITIES_DICT = {
353        'cripple': 'Paraplegia (cripple)',
354        'deaf': 'Deaf',
355        'dumb': 'Dumb',
356        'blind': 'Blind',
357        'others': 'Others',
358        }
359
360    GRADING_SYSTEM_DICT = {
361        'A': 'Regular Course Grading System (2018/2019 till date)',
362        'B': 'Old Course Grading System (2012/2013 - 2017/2018)',
363        }
364
365    CURRENCY_DICT = {
366        'NGN': u"\N{naira sign} (Naira)",
367        'EUR': u"\N{euro sign} (Euro)",
368        'USD': u"\N{dollar sign} (US Dollar)",
369        'GBP': u"\N{pound sign} (Pound Sterling)",
370        }
371
372    @property
373    def tzinfo(self):
374        return pytz.timezone('Africa/Lagos')
Note: See TracBrowser for help on using the repository browser.