[3709] | 1 | ## Script (Python) "getNextInfo" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=student_brain |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: getNextInfo.py 2678 2007-11-16 13:41:44Z henrik $ |
---|
| 11 | """ |
---|
| 12 | return the students next info |
---|
| 13 | """ |
---|
| 14 | try: |
---|
| 15 | from Products.zdb import set_trace |
---|
| 16 | except: |
---|
| 17 | def set_trace(): |
---|
| 18 | pass |
---|
| 19 | |
---|
| 20 | info = {} |
---|
| 21 | |
---|
| 22 | reasons = '' |
---|
[5205] | 23 | info['payment_allowed'] = False |
---|
[3709] | 24 | |
---|
| 25 | session_id = student_brain.session |
---|
| 26 | level_id = student_brain.level |
---|
| 27 | review_state = student_brain.review_state |
---|
| 28 | verdict = student_brain.verdict |
---|
| 29 | |
---|
| 30 | has_verdict = verdict and verdict != 'N/A' |
---|
| 31 | has_session = session_id and session_id != 'N/A' |
---|
| 32 | has_level = level_id and level_id != 'N/A' |
---|
| 33 | |
---|
| 34 | info['next_transition'] = None |
---|
| 35 | info['next_session_id'] = next_session_id = session_id |
---|
| 36 | info['next_level_id'] = next_level_id = level_id |
---|
| 37 | info['next_verdict'] = verdict |
---|
| 38 | info['next_previous_verdict'] = '' |
---|
| 39 | verdicts_voc = context.portal_vocabularies.verdicts |
---|
| 40 | if review_state == 'cleared_and_validated': |
---|
| 41 | info['next_transition'] = "pay_school_fee" |
---|
| 42 | info['next_verdict'] = '' |
---|
[5205] | 43 | info['payment_allowed'] = True |
---|
[3709] | 44 | elif review_state == 'returning' and has_verdict and has_level and has_session: |
---|
[5205] | 45 | info['payment_allowed'] = True |
---|
[3709] | 46 | info['next_session_id'] = next_session_id = "%02d" % (int(session_id)+1) |
---|
| 47 | if int(session_id) > 4: |
---|
| 48 | info['next_transition'] = "pay_school_fee" |
---|
| 49 | info['next_verdict'] = '' |
---|
| 50 | info['next_previous_verdict'] = verdict |
---|
[4554] | 51 | if verdict in ('A','B','M','N','Z',): |
---|
[3709] | 52 | info['next_level_id'] = "%s" % (divmod(int(level_id),100)[0]*100 + 100) |
---|
| 53 | elif verdict == 'C': |
---|
| 54 | info['next_level_id'] = "%s" % (int(level_id) + 10) |
---|
| 55 | else: |
---|
| 56 | info['next_level_id'] = level_id |
---|
| 57 | else: |
---|
| 58 | info['next_level_id'] = "%s" % (int(level_id) + 100) |
---|
| 59 | elif review_state == 'returning' and not (has_session and has_level and has_verdict): |
---|
| 60 | reasons = "Your data record is incomplete. School fee payment has been disabled, please contact your faculty!" |
---|
| 61 | |
---|
| 62 | info['reasons'] = reasons |
---|
| 63 | info['next_session_str'] = context.getSessionsVoc(next_session_id) |
---|
| 64 | |
---|
| 65 | return info |
---|