Last change
on this file since 17952 was
3397,
checked in by joachim, 17 years ago
|
first analysis for #115 okene
|
-
Property svn:keywords set to
Id
|
File size:
960 bytes
|
Line | |
---|
1 | ## Script (Python) "getLevelsFromCourseResults" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters=student_id=None |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | # $Id: getLevelsFromCourseResults.py 3397 2008-03-31 10:07:17Z joachim $ |
---|
11 | """ |
---|
12 | return Info about the Students StudyCourse |
---|
13 | """ |
---|
14 | import DateTime |
---|
15 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
16 | |
---|
17 | mtool = context.portal_membership |
---|
18 | if mtool.isAnonymousUser(): |
---|
19 | return None |
---|
20 | |
---|
21 | try: |
---|
22 | from Products.zdb import set_trace |
---|
23 | except: |
---|
24 | def set_trace(): |
---|
25 | pass |
---|
26 | import logging |
---|
27 | logger = logging.getLogger('Skins.getLevelsFromCourseResults') |
---|
28 | request = context.REQUEST |
---|
29 | |
---|
30 | if student_id is None: |
---|
31 | student_id = context.getStudentId() |
---|
32 | query = Eq('student_id',student_id) |
---|
33 | results = context.course_results.evalAdvancedQuery(query,(('level_id','desc'),)) |
---|
34 | old_level = 'xxx' |
---|
35 | levels = [] |
---|
36 | for result in results: |
---|
37 | if result.level_id != old_level: |
---|
38 | old_level = result.level_id |
---|
39 | levels += old_level, |
---|
40 | return levels |
---|
41 | |
---|
Note: See
TracBrowser for help on using the repository browser.