Ignore:
Timestamp:
23 Jun 2023, 07:36:56 (18 months ago)
Author:
Henrik Bettermann
Message:

Hase further adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r17446 r17447  
    3232MINIMUM_UNITS_THRESHOLD = 15
    3333
    34 schoolfees_path = os.path.join(
    35     os.path.dirname(__file__), 'schoolfees_22.csv')
    36 reader = csv.DictReader(open(schoolfees_path, 'rb'))
    37 SCHOOLFEES_22 = {item['code']:(item['tuition'], item.values()) for item in reader}
    38 
    39 schoolfees_path = os.path.join(
    40     os.path.dirname(__file__), 'schoolfees_21.csv')
    41 reader = csv.DictReader(open(schoolfees_path, 'rb'))
    42 SCHOOLFEES_21 = {item['code']:(item['tuition'], item.values()) for item in reader}
    43 
    44 schoolfees_path = os.path.join(
    45     os.path.dirname(__file__), 'schoolfees_20.csv')
    46 reader = csv.DictReader(open(schoolfees_path, 'rb'))
    47 SCHOOLFEES_20 = {item['code']:(item['tuition'], item.values()) for item in reader}
    48 
    49 schoolfees_path = os.path.join(
    50     os.path.dirname(__file__), 'schoolfees_19.csv')
    51 reader = csv.DictReader(open(schoolfees_path, 'rb'))
    52 SCHOOLFEES_19 = {item['code']:(item['tuition'], item.values()) for item in reader}
    53 
    54 schoolfees_path = os.path.join(
    55     os.path.dirname(__file__), 'schoolfees_14.csv')
    56 reader = csv.DictReader(open(schoolfees_path, 'rb'))
    57 SCHOOLFEES_14 = {item['code']:(item['tuition'], item.values()) for item in reader}
    58 
    59 schoolfees_path = os.path.join(
    60     os.path.dirname(__file__), 'schoolfees_13.csv')
    61 reader = csv.DictReader(open(schoolfees_path, 'rb'))
    62 SCHOOLFEES_13 = {item['code']:(item['tuition'], item.values()) for item in reader}
    63 
    64 schoolfees_path = os.path.join(
    65     os.path.dirname(__file__), 'schoolfees_12.csv')
    66 reader = csv.DictReader(open(schoolfees_path, 'rb'))
    67 SCHOOLFEES_12 = {item['code']:(item['tuition'], item.values()) for item in reader}
     34SCHOOLFEES = dict()
     35SFEECHANGES = (12, 13, 14, 19, 20, 21, 22)
     36
     37for year in SFEECHANGES:
     38    schoolfees_path = os.path.join(
     39        os.path.dirname(__file__), 'schoolfees_%s.csv' %year)
     40    reader = csv.DictReader(open(schoolfees_path, 'rb'))
     41    SCHOOLFEES[year] = {item['code']:(item['tuition'], item.values()) for item in reader}
    6842
    6943acceptancefees_path = os.path.join(
     
    416390            try:
    417391                if student.entry_session < 2013:
    418                     schoolfees = SCHOOLFEES_12[student.certcode]
     392                    schoolfees = SCHOOLFEES[12][student.certcode]
    419393                elif student.entry_session < 2014:
    420                     schoolfees = SCHOOLFEES_13[student.certcode]
     394                    schoolfees = SCHOOLFEES[13][student.certcode]
    421395                elif student.entry_session < 2015:
    422                     schoolfees = SCHOOLFEES_14[student.certcode]
     396                    schoolfees = SCHOOLFEES[14][student.certcode]
    423397                elif student.entry_session < 2020:
    424                     schoolfees = SCHOOLFEES_19[student.certcode]
     398                    schoolfees = SCHOOLFEES[19][student.certcode]
    425399                elif student.entry_session < 2021:
    426                     schoolfees = SCHOOLFEES_20[student.certcode]
     400                    schoolfees = SCHOOLFEES[20][student.certcode]
    427401                elif student.entry_session < 2022:
    428                     schoolfees = SCHOOLFEES_21[student.certcode]
     402                    schoolfees = SCHOOLFEES[21][student.certcode]
    429403                else:
    430                     schoolfees = SCHOOLFEES_22[student.certcode]
     404                    schoolfees = SCHOOLFEES[22][student.certcode]
    431405            except KeyError:
    432406                return _('School fees not yet fixed.'), None
Note: See TracChangeset for help on using the changeset viewer.