Ignore:
Timestamp:
28 Sep 2012, 06:22:59 (12 years ago)
Author:
Henrik Bettermann
Message:

In Uniben we have special pg students which follow the ug workflow.

See ticket 838:

Whereas the full time LLM students are to register all the four courses once, the part time LLM students are only permitted to register any two of the four courses in their first year and the remaining two courses including any carryover in the second or third year. Presently they do not have any problem with full time LLM online course registration but they certainly are not happy with the way LLM part time students are registering their cousres online as if they are full time students.

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

Legend:

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

    r9222 r9251  
    2727    StudentClearPage, StudentRejectClearancePage,
    2828    StudyCourseDisplayFormPage, msave, emit_lock_message)
     29from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS
    2930from kofacustom.nigeria.students.browser import (
    3031    NigeriaOnlinePaymentDisplayFormPage,
     32    NigeriaStudentBaseManageFormPage,
    3133    NigeriaOnlinePaymentAddFormPage,
    3234    NigeriaExportPDFPaymentSlipPage)
     35#from waeup.uniben.students.interfaces import ICustomStudent
    3336
    3437from waeup.uniben.students.interfaces import (
    3538    ICustomStudentOnlinePayment, ICustomStudentStudyCourse)
    3639from waeup.uniben.interfaces import MessageFactory as _
     40
     41class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage):
     42    """ View to manage student base data
     43    """
     44    #grok.context(ICustomStudent)
     45
     46    def getTransitions(self):
     47        """Return a list of dicts of allowed transition ids and titles.
     48
     49        Each list entry provides keys ``name`` and ``title`` for
     50        internal name and (human readable) title of a single
     51        transition.
     52        """
     53        allowed_transitions = [t for t in self.wf_info.getManualTransitions()
     54            if not t[0].startswith('pay')]
     55        if self.context.is_postgrad and not self.context.is_special_postgrad:
     56            allowed_transitions = [t for t in allowed_transitions
     57                if not t[0] in FORBIDDEN_POSTGRAD_TRANS]
     58        return [dict(name='', title=_('No transition'))] +[
     59            dict(name=x, title=y) for x, y in allowed_transitions]
    3760
    3861class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
  • main/waeup.uniben/trunk/src/waeup/uniben/students/student.py

    r8988 r9251  
    3535    grok.provides(ICustomStudent)
    3636
     37    @property
     38    def is_special_postgrad(self):
     39        is_special_postgrad = getattr(
     40            self.get('studycourse', None), 'is_special_postgrad', False)
     41        return is_special_postgrad
     42
    3743
    3844# Set all attributes of Student required in IStudent as field
  • main/waeup.uniben/trunk/src/waeup/uniben/students/studycourse.py

    r8865 r9251  
    3737
    3838    @property
     39    def is_postgrad(self):
     40        if self.certificate is None:
     41            return False
     42        return self.certificate.study_mode.startswith('pg') or \
     43            self.certificate.study_mode.startswith('special_pg')
     44
     45    @property
     46    def is_special_postgrad(self):
     47        if self.certificate is None:
     48            return False
     49        return self.certificate.study_mode.startswith('special_pg')
     50
     51    @property
    3952    def next_session_allowed(self):
    4053        state = self.student.state
     
    5669        cond5 = self.is_postgrad
    5770        cond6 = state == PAID
    58         if  cond5 and cond6:
     71        cond7 = self.is_special_postgrad
     72        if  cond5 and cond6 and not cond7:
    5973            return True
    6074        return False
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r9210 r9251  
    7373    layer = FunctionalLayer
    7474
     75    def test_next_session_allowed(self):
     76        # Let's see if next_session_allowed works as expected
     77        # A, ug_ft, 100
     78        IWorkflowState(self.student).setState('returning')
     79        self.assertTrue(self.student['studycourse'].next_session_allowed)
     80        # Uniben special PG programmes have the same workflow
     81        # as UG students
     82        self.certificate.study_mode = 'special_pg_pt'
     83        self.assertTrue(self.student['studycourse'].next_session_allowed)
     84        IWorkflowState(self.student).setState('school fee paid')
     85        self.assertFalse(self.student['studycourse'].next_session_allowed)
     86        # Now we convert the certificate into a 'regular
     87        # postgraduate certificate ...
     88        self.certificate.study_mode = 'pg_ft'
     89        # ... and voila next session registration is allowed
     90        self.assertTrue(self.student['studycourse'].next_session_allowed)
     91
     92    def test_manage_access(self):
     93        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     94        # The student created in the base package is a ug student
     95        self.browser.open(self.manage_clearance_path)
     96        self.assertMatches('...First Sitting Record...',
     97                           self.browser.contents)
     98        # There is no pg field in the clearance form
     99        self.assertFalse('Second Higher Education Record'
     100            in self.browser.contents)
     101        # Now we change the study mode ...
     102        self.certificate.study_mode = 'pg_ft'
     103        self.browser.open(self.clearance_path)
     104        # ... and additional pg clearance fields appear
     105        self.assertMatches('...Second Higher Education Record...',
     106                           self.browser.contents)
     107        # But also fields from the ug form are displayed
     108        self.assertMatches('...First Sitting Record...',
     109                           self.browser.contents)
     110        # The same holds for Uniben's special pg students
     111        self.certificate.study_mode = 'special_pg_ft'
     112        self.browser.open(self.clearance_path)
     113        self.assertMatches('...Second Higher Education Record...',
     114                           self.browser.contents)
     115        self.assertMatches('...First Sitting Record...',
     116                           self.browser.contents)
     117
    75118    def test_manage_payments(self):
    76119        # Add missing configuration data
     
    301344        self.assertEqual(payment.p_item, u'CERT1')
    302345        self.assertEqual(error, None)
    303 
    304346        self.student.is_staff = True
    305347        error, payment = utils.setPaymentDetails('schoolfee',
     
    332374        self.assertEqual(payment.p_session, 2005)
    333375        self.assertEqual(payment.amount_auth, 20088.0)
     376        self.assertEqual(payment.p_item, u'CERT1')
     377        self.assertEqual(error, None)
     378
     379        # In Uniben we have pg and special pg students.
     380        # They pay the same but their workflow is different.
     381        IWorkflowState(self.student).setState('school fee paid')
     382        self.student.is_staff = False
     383        self.student.nationality = u'NG'
     384        self.certificate.school_fee_2 = 10000.0
     385        error, payment = utils.setPaymentDetails(
     386            'schoolfee', self.student, None, None)
     387        self.assertEqual(payment, None)
     388        self.assertTrue('not be determined' in error)
     389        self.certificate.study_mode = 'pg_pt'
     390        self.assertTrue(self.student.is_postgrad)
     391        self.assertFalse(self.student.is_special_postgrad)
     392        error, payment = utils.setPaymentDetails(
     393            'schoolfee', self.student, None, None)
     394        self.assertEqual(payment.p_level, 100)
     395        self.assertEqual(payment.p_session, 2005)
     396        self.assertEqual(payment.amount_auth, 10000.0)
     397        self.assertEqual(payment.p_item, u'CERT1')
     398        self.assertEqual(error, None)
     399        self.certificate.study_mode = 'special_pg_pt'
     400        self.assertTrue(self.student.is_postgrad)
     401        self.assertTrue(self.student.is_special_postgrad)
     402        error, payment = utils.setPaymentDetails(
     403            'schoolfee', self.student, None, None)
     404        self.assertTrue('not be determined' in error)
     405        IWorkflowState(self.student).setState('returning')
     406        error, payment = utils.setPaymentDetails(
     407            'schoolfee', self.student, None, None)
     408        self.assertEqual(payment.p_level, 200)
     409        self.assertEqual(payment.p_session, 2005)
     410        self.assertEqual(payment.amount_auth, 10000.0)
    334411        self.assertEqual(payment.p_item, u'CERT1')
    335412        self.assertEqual(error, None)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r9206 r9251  
    132132                    except KeyError:
    133133                        return _(u'Session configuration object is not available.'), None
    134                 elif student.is_postgrad and student.state == PAID:
    135                     # Returning postgraduate students also pay for the next session
    136                     # but their level always remains the same.
     134                elif student.state == PAID  and student.is_postgrad and \
     135                    not student.is_special_postgrad:
     136                    # Regular returning postgraduate students also pay
     137                    # for the next session but their level always remains the same.
    137138                    p_session += 1
    138139                    if student.is_foreigner:
Note: See TracChangeset for help on using the changeset viewer.