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