Ignore:
Timestamp:
9 Jul 2012, 13:38:21 (12 years ago)
Author:
Henrik Bettermann
Message:

Fix bug. Returning students and pg students get penalty fee data from next academic_session.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r8906 r8959  
    152152        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    153153        self.browser.getControl("Create ticket").click()
     154        self.assertMatches('...Session configuration object is not...',
     155                           self.browser.contents)
     156        # Uups, we forgot to add a session configuration for next session
     157        configuration = createObject('waeup.SessionConfiguration')
     158        configuration.academic_session = 2005
     159        self.app['configuration'].addSessionConfiguration(configuration)
     160        self.browser.open(self.payments_path + '/addop')
     161        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     162        self.browser.getControl("Create ticket").click()
    154163        self.assertMatches('...ticket created...',
    155164                           self.browser.contents)
     
    188197        utils = getUtility(IStudentsUtils)
    189198
     199        configuration = createObject('waeup.SessionConfiguration')
     200        configuration.academic_session = 2005
     201        self.app['configuration'].addSessionConfiguration(configuration)
     202
    190203        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    191204        self.assertEqual(payment, None)
     
    200213        self.assertEqual(error, None)
    201214
    202         # Add penalty fee.
     215        # Add penalty fee ...
     216        # ... for cleared
    203217        self.app['configuration']['2004'].penalty_ug = 99.0
     218        # ... for returning
     219        self.app['configuration']['2005'].penalty_ug = 88.0
    204220        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    205221        self.assertEqual(payment.amount_auth, 40099.0)
     
    209225        self.assertEqual(payment.p_level, 200)
    210226        self.assertEqual(payment.p_session, 2005)
    211         self.assertEqual(payment.amount_auth, 20099.0)
     227        self.assertEqual(payment.amount_auth, 20088.0)
    212228        self.assertEqual(payment.p_item, u'CERT1')
    213229        self.assertEqual(error, None)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r8950 r8959  
    9797                p_session, p_level = self.getReturningData(student)
    9898                amount = getattr(certificate, 'school_fee_2', 0.0)
     99                try:
     100                    academic_session = grok.getSite()[
     101                        'configuration'][str(p_session)]
     102                except KeyError:
     103                    return _(u'Session configuration object is not available.'), None
    99104            elif student.is_postgrad and student.state == PAID:
    100105                # Returning postgraduate students also pay for the next session
     
    102107                p_session += 1
    103108                amount = getattr(certificate, 'school_fee_2', 0.0)
     109                try:
     110                    academic_session = grok.getSite()[
     111                        'configuration'][str(p_session)]
     112                except KeyError:
     113                    return _(u'Session configuration object is not available.'), None
    104114        if amount in (0.0, None):
    105115            return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.