[8810] | 1 | ## $Id: utils.py 16814 2022-02-16 15:57:12Z 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'), |
---|
| 35 | ] |
---|
| 36 | |
---|
[8817] | 37 | class 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', |
---|
[16814] | 222 | 'centre_of': 'Centre of', |
---|
[8810] | 223 | 'institute': 'Institute of', |
---|
| 224 | 'school_for': 'School for', |
---|
| 225 | 'college': 'College of', |
---|
[10303] | 226 | 'directorate': 'Directorate of', |
---|
[8810] | 227 | } |
---|
| 228 | |
---|
| 229 | STUDY_MODES_DICT = { |
---|
[9230] | 230 | 'ume_ft': 'UME Full Time', |
---|
[8934] | 231 | 'ug_ft': 'Undergraduate Full Time', |
---|
| 232 | 'ug_pt': 'Undergraduate Part Time', |
---|
[8810] | 233 | 'dp_pt': 'Diploma Part Time', |
---|
| 234 | 'ct_ft': 'Certificate Full Time', |
---|
| 235 | 'dp_ft': 'Diploma Full Time', |
---|
[8934] | 236 | 'de_ft': 'Direct Entry Full Time', |
---|
[8810] | 237 | 'de_pt': 'Direct Entry Part Time', |
---|
[9349] | 238 | 'nd_ft': 'National Diploma Full Time', |
---|
| 239 | 'nd_pt': 'National Diploma Part Time', |
---|
| 240 | 'hnd_ft': 'Higher National Diploma Full Time', |
---|
| 241 | 'hnd_pt': 'Higher National Diploma Part Time', |
---|
[8810] | 242 | 'pg_ft': 'Postgraduate Full Time', |
---|
| 243 | 'pg_pt': 'Postgraduate Part Time', |
---|
[9349] | 244 | 'pgd_ft': 'Postgraduate Diploma Full Time', |
---|
| 245 | 'pgd_pt': 'Postgraduate Diploma Part Time', |
---|
[16491] | 246 | 'pgphd': 'Postgraduate PhD/MPhil', |
---|
[10156] | 247 | 'special_pg_pt': 'Special Postgraduate Part Time', |
---|
[9941] | 248 | 'nce_ft': 'NCE Full Time', |
---|
| 249 | 'nce_pt': 'NCE Part Time', |
---|
[8934] | 250 | 'ug_sw': 'Undergraduate Sandwich', |
---|
[9942] | 251 | 'nce_sw': 'NCE Sandwich', |
---|
[8810] | 252 | 'jm_ft': 'Joint Matriculation Full Time', |
---|
| 253 | 'ph_ft': 'Post Higher Education Full Time', |
---|
| 254 | 'transfer_pt': 'Transfer Part Time', |
---|
| 255 | 'transfer_ft': 'Transfer Full Time', |
---|
| 256 | 'ct_pt': 'Certificate Part Time', |
---|
[8934] | 257 | 'rmd_ft': 'Remedial with deficiencies', |
---|
[9144] | 258 | 'rm_ft': 'Remedial', |
---|
[9163] | 259 | 'transfer': 'Transfer', |
---|
| 260 | 'prence': 'Pre-NCE', |
---|
[9349] | 261 | 'prend': 'Pre-ND', |
---|
[9164] | 262 | 'pce': 'PCE', |
---|
[9165] | 263 | 'pd_ft': 'Professional Diploma in Education', |
---|
[10892] | 264 | 'found': 'Foundation', |
---|
[10087] | 265 | 'no': 'no application', |
---|
[8810] | 266 | } |
---|
| 267 | |
---|
| 268 | APP_CATS_DICT = { |
---|
[13945] | 269 | 'basic': 'UAS, PUTME, PUDE, PCE, PRENCE', |
---|
[9085] | 270 | 'no': 'No Application', |
---|
[8810] | 271 | 'pg_ft': 'Postgraduate Full-Time', |
---|
| 272 | 'pg_pt': 'Postgraduate Part-Time', |
---|
| 273 | 'sandwich': 'Sandwich', |
---|
[9085] | 274 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
[13142] | 275 | 'pre': 'Pre-Degree Studies', |
---|
[8810] | 276 | } |
---|
| 277 | |
---|
[13126] | 278 | VERDICTS_DICT = { |
---|
| 279 | '0': 'not yet', |
---|
| 280 | 'A': 'Successful student', |
---|
| 281 | 'B': 'Student with carryover courses', |
---|
| 282 | 'C': 'Student on probation', |
---|
| 283 | 'D': 'Withdrawn from the faculty', |
---|
| 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', # FCEOkene only |
---|
| 295 | 'P': 'Exhausted maximum years in the university', |
---|
[16436] | 296 | 'R': 'Register Excess Credit', |
---|
[13126] | 297 | 'Y': 'No previous verdict', |
---|
| 298 | 'X': 'New 300 level student (Uniben)', |
---|
| 299 | 'Z': 'Successful student (provisional)', |
---|
| 300 | 'A1': 'First Class', |
---|
| 301 | 'A2': 'Second Class Upper', |
---|
| 302 | 'A3': 'Second Class Lower', |
---|
| 303 | 'A4': 'Third Class', |
---|
| 304 | 'A5': 'Pass', |
---|
| 305 | 'A6': 'Distinction', |
---|
| 306 | 'A7': 'Credit', |
---|
| 307 | 'A8': 'Merit', |
---|
[15456] | 308 | 'A9': 'Cert Not Classified', |
---|
[15481] | 309 | 'A10': 'Upper Credit', |
---|
| 310 | 'A11': 'Lower Credit', |
---|
[13126] | 311 | } |
---|
| 312 | |
---|
[15489] | 313 | DISABILITIES_DICT = { |
---|
| 314 | 'cripple': 'Paraplegia (cripple)', |
---|
| 315 | 'deaf': 'Deaf', |
---|
| 316 | 'dumb': 'Dumb', |
---|
| 317 | 'blind': 'Blind', |
---|
| 318 | 'others': 'Others', |
---|
| 319 | } |
---|
[13126] | 320 | |
---|
[16508] | 321 | GRADING_SYSTEM_DICT = { |
---|
| 322 | 'A': 'Regular Course Grading System (2018/2019 till date)', |
---|
| 323 | 'B': 'Old Course Grading System (2012/2013 - 2017/2018)', |
---|
| 324 | } |
---|
[15489] | 325 | |
---|
[8810] | 326 | @property |
---|
| 327 | def tzinfo(self): |
---|
| 328 | return pytz.timezone('Africa/Lagos') |
---|