1 | ## $Id: utils.py 16491 2021-05-25 05:52:23Z 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 | """ |
---|
20 | import os |
---|
21 | import pytz |
---|
22 | from waeup.kofa.utils.utils import KofaUtils, sorted_phone_prefixes |
---|
23 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
24 | from kofacustom.nigeria.utils.degrees import DEGREES_DICT |
---|
25 | |
---|
26 | INT_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 | |
---|
37 | class NigeriaKofaUtils(KofaUtils): |
---|
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 | |
---|
56 | DEGREES_DICT = DEGREES_DICT |
---|
57 | |
---|
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', |
---|
69 | 'awaiting_results': 'Awaiting Results', |
---|
70 | 'basic_electricity': 'Basic Electricity', |
---|
71 | 'bible_knowledge': 'Bible Knowledge', |
---|
72 | 'biology': 'Biology', |
---|
73 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
74 | 'block_brick_concrete': 'Block Laying, Brick Laying and Concreting', |
---|
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', |
---|
87 | 'edo': 'Edo Language', |
---|
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', |
---|
95 | 'fine_art': 'Fine Art', |
---|
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', |
---|
107 | 'home_economics': 'Home Economics', |
---|
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', |
---|
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', |
---|
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', |
---|
172 | # Added after 19/01/2015 |
---|
173 | 'marketing': 'Marketing', |
---|
174 | 'carpentry_joinery': 'Carpentry and Joinery', |
---|
175 | 'tourism': 'Tourism', |
---|
176 | 'mining': 'Mining', |
---|
177 | 'furniture_making': 'Furniture Making', |
---|
178 | 'information_communication_technology': 'Information and Communication Technology', |
---|
179 | 'salesmanship': 'Salesmanship', |
---|
180 | 'welding_and_fabrication': 'Welding and Fabrication', |
---|
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)'), |
---|
207 | ('Gg', 'G (g)'), |
---|
208 | ('credit-1', 'Credit-1'), |
---|
209 | ('credit-2', 'Credit-2'), |
---|
210 | ('dist', 'Distinction'), |
---|
211 | ('pass', 'Pass'), |
---|
212 | ('AR', 'Awaiting Results'), |
---|
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', |
---|
225 | 'directorate': 'Directorate of', |
---|
226 | } |
---|
227 | |
---|
228 | STUDY_MODES_DICT = { |
---|
229 | 'ume_ft': 'UME Full Time', |
---|
230 | 'ug_ft': 'Undergraduate Full Time', |
---|
231 | 'ug_pt': 'Undergraduate Part Time', |
---|
232 | 'dp_pt': 'Diploma Part Time', |
---|
233 | 'ct_ft': 'Certificate Full Time', |
---|
234 | 'dp_ft': 'Diploma Full Time', |
---|
235 | 'de_ft': 'Direct Entry Full Time', |
---|
236 | 'de_pt': 'Direct Entry Part Time', |
---|
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', |
---|
241 | 'pg_ft': 'Postgraduate Full Time', |
---|
242 | 'pg_pt': 'Postgraduate Part Time', |
---|
243 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
244 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
245 | 'pgphd': 'Postgraduate PhD/MPhil', |
---|
246 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
247 | 'nce_ft': 'NCE Full Time', |
---|
248 | 'nce_pt': 'NCE Part Time', |
---|
249 | 'ug_sw': 'Undergraduate Sandwich', |
---|
250 | 'nce_sw': 'NCE Sandwich', |
---|
251 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
252 | 'ph_ft': 'Post Higher Education Full Time', |
---|
253 | 'transfer_pt': 'Transfer Part Time', |
---|
254 | 'transfer_ft': 'Transfer Full Time', |
---|
255 | 'ct_pt': 'Certificate Part Time', |
---|
256 | 'rmd_ft': 'Remedial with deficiencies', |
---|
257 | 'rm_ft': 'Remedial', |
---|
258 | 'transfer': 'Transfer', |
---|
259 | 'prence': 'Pre-NCE', |
---|
260 | 'prend': 'Pre-ND', |
---|
261 | 'pce': 'PCE', |
---|
262 | 'pd_ft': 'Professional Diploma in Education', |
---|
263 | 'found': 'Foundation', |
---|
264 | 'no': 'no application', |
---|
265 | } |
---|
266 | |
---|
267 | APP_CATS_DICT = { |
---|
268 | 'basic': 'UAS, PUTME, PUDE, PCE, PRENCE', |
---|
269 | 'no': 'No Application', |
---|
270 | 'pg_ft': 'Postgraduate Full-Time', |
---|
271 | 'pg_pt': 'Postgraduate Part-Time', |
---|
272 | 'sandwich': 'Sandwich', |
---|
273 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
274 | 'pre': 'Pre-Degree Studies', |
---|
275 | } |
---|
276 | |
---|
277 | VERDICTS_DICT = { |
---|
278 | '0': 'not yet', |
---|
279 | 'A': 'Successful student', |
---|
280 | 'B': 'Student with carryover courses', |
---|
281 | 'C': 'Student on probation', |
---|
282 | 'D': 'Withdrawn from the faculty', |
---|
283 | 'E': 'Student who were previously on probation', |
---|
284 | 'F': 'Medical case', |
---|
285 | 'G': 'Absent from examination', |
---|
286 | 'H': 'Withheld results', |
---|
287 | 'I': 'Expelled/rusticated/suspended student', |
---|
288 | 'J': 'Temporary withdrawn from the university', |
---|
289 | 'K': 'Unregistered student', |
---|
290 | 'L': 'Referred student', |
---|
291 | 'M': 'Reinstatement', |
---|
292 | 'N': 'Student on transfer', |
---|
293 | #'O': 'NCE-III repeater', # FCEOkene only |
---|
294 | 'P': 'Exhausted maximum years in the university', |
---|
295 | 'R': 'Register Excess Credit', |
---|
296 | 'Y': 'No previous verdict', |
---|
297 | 'X': 'New 300 level student (Uniben)', |
---|
298 | 'Z': 'Successful student (provisional)', |
---|
299 | 'A1': 'First Class', |
---|
300 | 'A2': 'Second Class Upper', |
---|
301 | 'A3': 'Second Class Lower', |
---|
302 | 'A4': 'Third Class', |
---|
303 | 'A5': 'Pass', |
---|
304 | 'A6': 'Distinction', |
---|
305 | 'A7': 'Credit', |
---|
306 | 'A8': 'Merit', |
---|
307 | 'A9': 'Cert Not Classified', |
---|
308 | 'A10': 'Upper Credit', |
---|
309 | 'A11': 'Lower Credit', |
---|
310 | } |
---|
311 | |
---|
312 | DISABILITIES_DICT = { |
---|
313 | 'cripple': 'Paraplegia (cripple)', |
---|
314 | 'deaf': 'Deaf', |
---|
315 | 'dumb': 'Dumb', |
---|
316 | 'blind': 'Blind', |
---|
317 | 'others': 'Others', |
---|
318 | } |
---|
319 | |
---|
320 | |
---|
321 | @property |
---|
322 | def tzinfo(self): |
---|
323 | return pytz.timezone('Africa/Lagos') |
---|