source: WAeUP_SRP/base/skins/waeup_student/get_student_levels.py @ 2635

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

add student_levels, fix for #397,cleanup removeUnusedDocIds

  • Property svn:keywords set to Id
File size: 656 bytes
Line 
1##parameters=key=None
2# $Id: get_student_levels.py 2632 2007-11-12 17:23:46Z joachim $
3"""
4Return the levels as an vocabulary
5#
6try:
7    from Products.zdb import set_trace
8except:
9    def set_trace():
10        pass
11"""
12
13if key is None:
14    return [("%s" % l,"Level %s" % l) for l in range(100,700,100)]
15ikey = int(key)
16level_nr,repeat = divmod(ikey, 100)
17l = []
18student = context.students_catalog(id = context.getStudentId())[0]
19
20level = context.portal_vocabularies.levels.get("%d00" % level_nr)
21if level_nr > int(student.end_level)/100:
22    return "%s (spillover)" % context.portal_vocabularies.levels.get("%d00" % (level_nr - 1))
23
24if repeat > 0:
25    level += " (on %d. probation)" % (repeat // 10)
26
27return level
28
Note: See TracBrowser for help on using the repository browser.