[8810] | 1 | ## $Id: utils.py 16922 2022-04-13 21:05:05Z 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 _ |
---|
[13618] | 24 | from kofacustom.nigeria.utils.degrees import DEGREES_DICT |
---|
[8810] | 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'), |
---|
[16922] | 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'), |
---|
[8810] | 74 | ] |
---|
| 75 | |
---|
[8817] | 76 | class NigeriaKofaUtils(KofaUtils): |
---|
[8810] | 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 | |
---|
[13618] | 95 | DEGREES_DICT = DEGREES_DICT |
---|
| 96 | |
---|
[8810] | 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', |
---|
[10997] | 108 | 'awaiting_results': 'Awaiting Results', |
---|
[8810] | 109 | 'basic_electricity': 'Basic Electricity', |
---|
| 110 | 'bible_knowledge': 'Bible Knowledge', |
---|
| 111 | 'biology': 'Biology', |
---|
| 112 | 'biology_alt_syl': 'Biology (Alt.Syl)', |
---|
[13531] | 113 | 'block_brick_concrete': 'Block Laying, Brick Laying and Concreting', |
---|
[8810] | 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', |
---|
[13666] | 126 | 'edo': 'Edo Language', |
---|
[8810] | 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', |
---|
[13160] | 134 | 'fine_art': 'Fine Art', |
---|
[8810] | 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', |
---|
[13160] | 146 | 'home_economics': 'Home Economics', |
---|
[8810] | 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', |
---|
[11549] | 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', |
---|
[11780] | 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', |
---|
[12613] | 211 | # Added after 19/01/2015 |
---|
[12495] | 212 | 'marketing': 'Marketing', |
---|
| 213 | 'carpentry_joinery': 'Carpentry and Joinery', |
---|
[12505] | 214 | 'tourism': 'Tourism', |
---|
[12551] | 215 | 'mining': 'Mining', |
---|
[12613] | 216 | 'furniture_making': 'Furniture Making', |
---|
[13343] | 217 | 'information_communication_technology': 'Information and Communication Technology', |
---|
[13433] | 218 | 'salesmanship': 'Salesmanship', |
---|
[13703] | 219 | 'welding_and_fabrication': 'Welding and Fabrication', |
---|
[8810] | 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)'), |
---|
[10997] | 246 | ('Gg', 'G (g)'), |
---|
[11587] | 247 | ('credit-1', 'Credit-1'), |
---|
| 248 | ('credit-2', 'Credit-2'), |
---|
| 249 | ('dist', 'Distinction'), |
---|
| 250 | ('pass', 'Pass'), |
---|
[10997] | 251 | ('AR', 'Awaiting Results'), |
---|
[8810] | 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', |
---|
[16814] | 261 | 'centre_of': 'Centre of', |
---|
[8810] | 262 | 'institute': 'Institute of', |
---|
| 263 | 'school_for': 'School for', |
---|
| 264 | 'college': 'College of', |
---|
[10303] | 265 | 'directorate': 'Directorate of', |
---|
[8810] | 266 | } |
---|
| 267 | |
---|
| 268 | STUDY_MODES_DICT = { |
---|
[9230] | 269 | 'ume_ft': 'UME Full Time', |
---|
[8934] | 270 | 'ug_ft': 'Undergraduate Full Time', |
---|
| 271 | 'ug_pt': 'Undergraduate Part Time', |
---|
[8810] | 272 | 'dp_pt': 'Diploma Part Time', |
---|
| 273 | 'ct_ft': 'Certificate Full Time', |
---|
| 274 | 'dp_ft': 'Diploma Full Time', |
---|
[8934] | 275 | 'de_ft': 'Direct Entry Full Time', |
---|
[8810] | 276 | 'de_pt': 'Direct Entry Part Time', |
---|
[9349] | 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', |
---|
[8810] | 281 | 'pg_ft': 'Postgraduate Full Time', |
---|
| 282 | 'pg_pt': 'Postgraduate Part Time', |
---|
[9349] | 283 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
| 284 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
[16491] | 285 | 'pgphd': 'Postgraduate PhD/MPhil', |
---|
[10156] | 286 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
[9941] | 287 | 'nce_ft': 'NCE Full Time', |
---|
| 288 | 'nce_pt': 'NCE Part Time', |
---|
[8934] | 289 | 'ug_sw': 'Undergraduate Sandwich', |
---|
[9942] | 290 | 'nce_sw': 'NCE Sandwich', |
---|
[8810] | 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', |
---|
[8934] | 296 | 'rmd_ft': 'Remedial with deficiencies', |
---|
[9144] | 297 | 'rm_ft': 'Remedial', |
---|
[9163] | 298 | 'transfer': 'Transfer', |
---|
| 299 | 'prence': 'Pre-NCE', |
---|
[9349] | 300 | 'prend': 'Pre-ND', |
---|
[9164] | 301 | 'pce': 'PCE', |
---|
[9165] | 302 | 'pd_ft': 'Professional Diploma in Education', |
---|
[10892] | 303 | 'found': 'Foundation', |
---|
[10087] | 304 | 'no': 'no application', |
---|
[8810] | 305 | } |
---|
| 306 | |
---|
| 307 | APP_CATS_DICT = { |
---|
[13945] | 308 | 'basic': 'UAS, PUTME, PUDE, PCE, PRENCE', |
---|
[9085] | 309 | 'no': 'No Application', |
---|
[8810] | 310 | 'pg_ft': 'Postgraduate Full-Time', |
---|
| 311 | 'pg_pt': 'Postgraduate Part-Time', |
---|
| 312 | 'sandwich': 'Sandwich', |
---|
[9085] | 313 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
[13142] | 314 | 'pre': 'Pre-Degree Studies', |
---|
[8810] | 315 | } |
---|
| 316 | |
---|
[13126] | 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', |
---|
[16436] | 335 | 'R': 'Register Excess Credit', |
---|
[13126] | 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', |
---|
[15456] | 347 | 'A9': 'Cert Not Classified', |
---|
[15481] | 348 | 'A10': 'Upper Credit', |
---|
| 349 | 'A11': 'Lower Credit', |
---|
[13126] | 350 | } |
---|
| 351 | |
---|
[15489] | 352 | DISABILITIES_DICT = { |
---|
| 353 | 'cripple': 'Paraplegia (cripple)', |
---|
| 354 | 'deaf': 'Deaf', |
---|
| 355 | 'dumb': 'Dumb', |
---|
| 356 | 'blind': 'Blind', |
---|
| 357 | 'others': 'Others', |
---|
| 358 | } |
---|
[13126] | 359 | |
---|
[16508] | 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 | } |
---|
[15489] | 364 | |
---|
[8810] | 365 | @property |
---|
| 366 | def tzinfo(self): |
---|
| 367 | return pytz.timezone('Africa/Lagos') |
---|