source: WAeUP_SRP/base/skins/waeup_student/getNextInfo.py @ 2464

Last change on this file since 2464 was 2464, checked in by joachim, 17 years ago

fix view

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
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 2464 2007-10-28 17:42:26Z joachim $
11"""
12return the students next info
13"""
14try:
15    from Products.zdb import set_trace
16except:
17    def set_trace():
18        pass
19
20info = {}
21
22session_id = student_brain.session
23level_id = student_brain.level
24review_state = student_brain.review_state
25verdict = student_brain.verdict
26info['next_transition'] = None
27info['next_session_id'] = next_session_id = session_id
28info['next_level_id'] = next_level_id = level_id
29reasons = []
30verdicts_voc = context.portal_vocabularies.verdicts
31if review_state == 'cleared_and_validated':
32    info['next_transition'] = "pay_school_fee"
33elif review_state == 'returning' and verdict and level_id and student_brain.session:
34    if int(session_id) > int(context.getSessionId()[0]) -2:
35        if verdict not in ('A','B',):
36            info['next_level_id'] = level_id
37            if not verdict:
38                reasons += "There is no verdict.",
39            else:
40                reasons += "Your are not a %s" % verdicts_voc.get('A'),
41                reasons += "or not a %s" % verdicts_voc.get('B'),
42        else:
43            info['next_level_id'] = "%s" % (int(level_id) + 100)
44            info['next_session_id'] = next_session_id = "%02d" % (int(session_id)+1)
45            info['next_transition'] = "pay_school_fee"
46info['reasons'] = reasons
47info['next_session_str'] = context.sessions_voc(next_session_id)
48
49return info
Note: See TracBrowser for help on using the repository browser.