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 2461 2007-10-28 16:47:34Z joachim $ |
---|
11 | """ |
---|
12 | return the students next info |
---|
13 | """ |
---|
14 | |
---|
15 | info = {} |
---|
16 | |
---|
17 | session_id = student_brain.session |
---|
18 | level_id = student_brain.level |
---|
19 | review_state = student_brain.review_state |
---|
20 | info['verdict'] = student_brain.verdict |
---|
21 | info['next_transition'] = None |
---|
22 | info['next_session_id'] = next_session_id = session_id |
---|
23 | info['next_level_id'] = next_level_id = level_id |
---|
24 | reasons = [] |
---|
25 | verdicts_voc = context.portal_vocabularies.verdicts |
---|
26 | if review_state == 'cleared_and_validated': |
---|
27 | info['next_transition'] = "pay_school_fee" |
---|
28 | elif review_state == 'returning' and verdict and level_id and session: |
---|
29 | info['next_level_id'] = "%s" % (int(level_id) + 100) |
---|
30 | info['next_session_id'] = next_session_id = "%02d" % (int(session_id)+1) |
---|
31 | if int(session_id) > int(context.getSessionId()[0]) -2: |
---|
32 | info['next_transition'] = "pay_school_fee" |
---|
33 | if verdict not in ('A','B',): |
---|
34 | info['next_level_id'] = level_id |
---|
35 | if not verdict: |
---|
36 | reasons += "There is no verdict." |
---|
37 | else: |
---|
38 | reasons += "Your are not a %s" % verdicts_voc.get('A') |
---|
39 | reasons += "or not a %s" % verdicts_voc.get('B') |
---|
40 | else: |
---|
41 | info['next_transition'] = "pay_school_fee" |
---|
42 | info['reasons'] = reasons |
---|
43 | info['next_session_str'] = context.sessions_voc(next_session_id) |
---|
44 | |
---|
45 | return info |
---|