Ignore:
Timestamp:
13 Sep 2011, 09:25:33 (13 years ago)
Author:
Henrik Bettermann
Message:

Add school fee payment transitions.

Implement set_returning_data function which is triggered when payment transition is fired (returning students only).

Save integer values in session fields. This eases the numerical processing of session values.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

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

    r6664 r6742  
    1313        sid = u"%c%d" % (letter,r().randint(99999,1000000))
    1414    return sid
     15
     16def set_returning_data(student):
     17    student['studycourse'].current_level += 100
     18    student['studycourse'].current_session += 1
     19    verdict = student['studycourse'].current_verdict
     20    student['studycourse'].current_verdict = ''
     21    student['studycourse'].previous_verdict = verdict
     22    return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py

    r6725 r6742  
    1717    curr_year = datetime.now().year
    1818    year_range = range(curr_year - 10, curr_year + 2)
    19     return [('%s/%s' % (year,year+1), '%s' % year) for year in year_range]
     19    return [('%s/%s' % (year,year+1), year) for year in year_range]
    2020
    2121entry_session_vocab = SimpleWAeUPVocabulary(*entry_sessions())
     
    6464
    6565verdicts = SimpleWAeUPVocabulary(
     66    ('Not set',''),
    6667    ('Successful student','A'),
    6768    ('Student with carryover courses','B'),
  • main/waeup.sirp/trunk/src/waeup/sirp/students/workflow.py

    r6723 r6742  
    55from hurry.workflow.workflow import Transition, WorkflowState, NullCondition
    66from hurry.workflow.interfaces import IWorkflowState, IWorkflowTransitionEvent
    7 from waeup.sirp.students.interfaces import IStudent
    87from waeup.sirp.interfaces import IObjectHistory, IWAeUPWorkflowInfo
    98from waeup.sirp.workflow import WAeUPWorkflow, WAeUPWorkflowInfo
    109from waeup.sirp.utils.helpers import get_current_principal
     10from waeup.sirp.students.interfaces import IStudent
     11from waeup.sirp.students.utils import set_returning_data
    1112
    1213CREATED = 'created'
     
    1516REQUESTED = 'clearance requested'
    1617CLEARED = 'cleared'
     18PAID = 'school fee paid'
     19RETURNING = 'returning'
    1720
    1821REGISTRATION_TRANSITIONS = (
     
    8083        source = CLEARED,
    8184        destination = CLEARANCE),
     85
     86    Transition(
     87        transition_id = 'pay_first_school_fee',
     88        title = 'Pay school fee',
     89        msg = 'School fee paid',
     90        source = CLEARED,
     91        destination = PAID),
     92
     93    Transition(
     94        transition_id = 'reset5',
     95        title = 'Reset to cleared',
     96        msg = 'Student record reset to cleared',
     97        source = PAID,
     98        destination = CLEARED),
     99
     100    Transition(
     101        transition_id = 'pay_school_fee',
     102        title = 'Pay school fee',
     103        msg = 'School fee paid',
     104        source = RETURNING,
     105        destination = PAID),
     106
     107    Transition(
     108        transition_id = 'reset6',
     109        title = 'Reset to returning',
     110        msg = 'Student record reset to returning',
     111        source = PAID,
     112        destination = RETURNING),
    82113    )
    83114
     
    117148    if event.transition.transition_id in UNLOCK_CLEARANCE_TRANS:
    118149        obj.clearance_locked = False
     150    # Student data don't change after first-time payment
     151    if event.transition.transition_id == 'pay_first_school_fee':
     152        pass
     153    # School fee payment of returning students triggers the change of
     154    # current session, current level, and current verdict
     155    if event.transition.transition_id == 'pay_school_fee':
     156        set_returning_data(obj)
    119157    # In some tests we don't have a students container or a user
    120158    try:
Note: See TracChangeset for help on using the changeset viewer.