Ignore:
Timestamp:
23 Oct 2012, 08:32:05 (12 years ago)
Author:
Henrik Bettermann
Message:

Apply Uli's new FeeTable? which is really a milestone.

File:
1 edited

Legend:

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

    r9388 r9393  
    2424from waeup.kofa.accesscodes import create_accesscode
    2525from waeup.kofa.interfaces import CLEARED, RETURNING
     26from waeup.kofa.fees import FeeTable
    2627from waeup.kwarapoly.interfaces import MessageFactory as _
     28
     29PAYMENT_LEVELS = (10, 100, 200, 210, 300, 400, 500, 510, 600, 999)
     30
     31FEES_PARAMS = (
     32        ('ft', 'pt'),
     33        ('local', 'non-local'),
     34        ('science','arts'),
     35        PAYMENT_LEVELS
     36    )
     37
     38FEES_VALUES = (
     39        (
     40          (
     41            (34400.00, 37100.00, 43000.00, 29300.00, 0.00, 37900.00, 29700.00, 29900.00, 0.00, 47550.00), # science
     42            (32900.00, 35600.00, 28000.00, 27800.00, 0.00, 36400.00, 28200.00, 28400.00, 0.00, 47550.00)  # arts
     43          ), # local
     44          (
     45            (41930.00, 44630.00, 44590.00, 36400.00, 0.00, 46330.00, 32900.00, 38100.00, 0.00, 60980.00), # science
     46            (40430.00, 43130.00, 29590.00, 34900.00, 0.00, 44830.00, 31400.00, 36600.00, 0.00, 60980.00)  # arts
     47          ), # non-local
     48        ), # ft
     49        (
     50          (
     51            (0.00, 38400.00, 30900.00, 0.00, 30900.00, 39000.00, 31550.00, 0.00, 31550.00, 0.00), # science
     52            (0.00, 36900.00, 29400.00, 0.00, 29400.00, 37500.00, 30050.00, 0.00, 30050.00, 0.00)  # arts
     53          ), # local
     54          (
     55            (0.00, 45600.00, 32350.00, 0.00, 32350.00, 47200.00, 35750.00, 0.00, 35750.00, 0.00), # science
     56            (0.00, 44100.00, 30850.00, 0.00, 30850.00, 45700.00, 34250.00, 0.00, 34250.00, 0.00)  # arts
     57          ), # non-local
     58        ), # pt
     59    )
     60
     61SCHOOL_FEES = FeeTable(FEES_PARAMS, FEES_VALUES)
     62
     63def local_nonlocal(student):
     64    lga = getattr(student, 'lga')
     65    if lga and student.lga.startswith('kwara'):
     66        return 'local'
     67    else:
     68        return 'non-local'
     69
     70def arts_science(student):
     71    if student.faccode == 'IFMS':
     72        return 'arts'
     73    else:
     74        return 'science'
     75
     76def pt_ft(student):
     77    if student.current_mode.endswith('pt'):
     78        return 'pt'
     79    else:
     80        return 'ft'
    2781
    2882class CustomStudentsUtils(NigeriaStudentsUtils):
     
    3084
    3185    """
     86
    3287
    3388    def selectBed(self, available_beds):
     
    96151            except (AttributeError, TypeError):
    97152                return _('Study course data are incomplete.'), None
    98 
    99 
    100153            if student.state == RETURNING:
    101154                p_session, p_level = self.getReturningData(student)
    102 
    103 
    104155            if student.state in (RETURNING, CLEARED):
    105                 amount = 60980.00
    106 
     156                if p_level in PAYMENT_LEVELS:
     157                    amount = SCHOOL_FEES.get_fee(
     158                        (pt_ft(student),
     159                         local_nonlocal(student),
     160                         arts_science(student),
     161                         p_level)
     162                        )
    107163        if amount in (0.0, None):
    108164            return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.