## Script (Python) "getNextInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student_brain ##title= ## # $Id: getNextInfo.py 2656 2007-11-14 21:28:30Z henrik $ """ return the students next info """ try: from Products.zdb import set_trace except: def set_trace(): pass info = {} reasons = '' session_id = student_brain.session level_id = student_brain.level review_state = student_brain.review_state verdict = student_brain.verdict has_verdict = verdict and verdict != 'N/A' has_session = session_id and session_id != 'N/A' has_level = level_id and level_id != 'N/A' info['next_transition'] = None info['next_session_id'] = next_session_id = session_id info['next_level_id'] = next_level_id = level_id info['next_verdict'] = verdict verdicts_voc = context.portal_vocabularies.verdicts if review_state == 'cleared_and_validated': info['next_transition'] = "pay_school_fee" info['next_verdict'] = '' elif review_state == 'returning' and has_verdict and has_level and has_session: info['next_session_id'] = next_session_id = "%02d" % (int(session_id)+1) if int(session_id) > 4: info['next_verdict'] = '' if verdict in ('A','B',): info['next_level_id'] = "%s" % (int(level_id) + 100) else: info['next_level_id'] = level_id if int(session_id) > int(context.getSessionId()[0]) -2: info['next_transition'] = "pay_school_fee" else: info['next_level_id'] = "%s" % (int(level_id) + 100) elif review_state == 'returning' and not (has_session and has_level and has_verdict): reasons = "Your data record is incomplete. School fee payment has been disabled, please contact your faculty!" info['reasons'] = reasons info['next_session_str'] = context.getSessionsVoc(next_session_id) return info