[2454] | 1 | ## Script (Python) "getNextInfo" |
---|
[2451] | 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 2475 2007-10-29 18:46:43Z henrik $ |
---|
| 11 | """ |
---|
| 12 | return the students next info |
---|
| 13 | """ |
---|
[2464] | 14 | try: |
---|
| 15 | from Products.zdb import set_trace |
---|
| 16 | except: |
---|
| 17 | def set_trace(): |
---|
| 18 | pass |
---|
[2454] | 19 | |
---|
[2451] | 20 | info = {} |
---|
[2454] | 21 | |
---|
[2466] | 22 | reasons = '' |
---|
| 23 | |
---|
[2454] | 24 | session_id = student_brain.session |
---|
| 25 | level_id = student_brain.level |
---|
| 26 | review_state = student_brain.review_state |
---|
[2462] | 27 | verdict = student_brain.verdict |
---|
[2466] | 28 | |
---|
| 29 | has_verdict = verdict and verdict != 'N/A' |
---|
| 30 | has_session = session_id and session_id != 'N/A' |
---|
| 31 | has_level = level_id and level_id != 'N/A' |
---|
| 32 | |
---|
[2451] | 33 | info['next_transition'] = None |
---|
[2454] | 34 | info['next_session_id'] = next_session_id = session_id |
---|
| 35 | info['next_level_id'] = next_level_id = level_id |
---|
[2475] | 36 | info['next_verdict'] = verdict |
---|
[2461] | 37 | verdicts_voc = context.portal_vocabularies.verdicts |
---|
[2454] | 38 | if review_state == 'cleared_and_validated': |
---|
[2451] | 39 | info['next_transition'] = "pay_school_fee" |
---|
[2475] | 40 | info['next_verdict'] = '' |
---|
[2466] | 41 | elif review_state == 'returning' and has_verdict and has_level and has_session: |
---|
| 42 | info['next_session_id'] = next_session_id = "%02d" % (int(session_id)+1) |
---|
[2459] | 43 | if int(session_id) > int(context.getSessionId()[0]) -2: |
---|
[2466] | 44 | info['next_transition'] = "pay_school_fee" |
---|
[2475] | 45 | info['next_verdict'] = '' |
---|
[2466] | 46 | if verdict in ('A','B',): |
---|
| 47 | info['next_level_id'] = "%s" % (int(level_id) + 100) |
---|
| 48 | else: |
---|
[2459] | 49 | info['next_level_id'] = level_id |
---|
[2466] | 50 | else: |
---|
| 51 | info['next_level_id'] = "%s" % (int(level_id) + 100) |
---|
[2473] | 52 | elif review_state == 'returning' and not (has_session and has_level and has_verdict): |
---|
[2466] | 53 | reasons = "Your data record is incomplete. School fee payment has been disabled, please contact your faculty!" |
---|
| 54 | |
---|
[2461] | 55 | info['reasons'] = reasons |
---|
[2454] | 56 | info['next_session_str'] = context.sessions_voc(next_session_id) |
---|
[2451] | 57 | |
---|
| 58 | return info |
---|