source: WAeUP_SRP/trunk/skins/waeup_student/getLecturerCourseResults.py @ 5212

Last change on this file since 5212 was 3611, checked in by Henrik Bettermann, 16 years ago

implement lecturer module (for demo purposes only)

File size: 1.7 KB
Line 
1## Script (Python) "getLecturerCourseResultsInfo"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=course_id
8##title=
9##
10# $Id: getCoursesInfo.py 3482 2008-05-01 05:54:53Z henrik $
11"""
12return Info about the Courses
13"""
14
15mtool = context.portal_membership
16member = mtool.getAuthenticatedMember()
17lec_id = member_id = str(member)
18if mtool.isAnonymousUser():
19    return None
20
21
22request = context.REQUEST
23
24path_info = request.get('PATH_INFO').split('/')
25
26info = {}
27info['lec_id'] = lec_id
28info['course_id'] = course_id
29
30res = context.course_results(code=course_id)
31items = [ brain for brain in res]
32rows = []
33for r in items:
34    row = {}
35    if r['carry_over']:
36        row['carry_over'] =  'CO'
37    else:
38        row['carry_over'] =  ''
39    row['credits'] =  r['credits']
40    row['session_id'] =  r['session_id']
41    row['level_id'] =  level_id = r['level_id']
42    row['score'] =  r['score']
43    row['student_id'] = student_id = r['student_id']
44   
45    student_record = context.students_catalog.getRecordByKey(student_id)
46    row['student_record'] = context.getFormattedStudentEntry(student_record)
47    row['url'] = "%s/campus/students/%s/study_course/%s" % (context.portal_url(),student_id,level_id)
48   
49    row['editable'] = not r['score'] and  row['student_record']['review_state'] == 'courses_validated'
50    row['sort_dummy'] = row['student_record']['review_state']
51    rows.append(row)
52   
53rows.sort(cmp=lambda x,y: cmp("%(session_id)s%(sort_dummy)s" % x,
54                              "%(session_id)s%(sort_dummy)s" % y))   
55info['students'] = rows
56
57return context.lecturer_students_list(info = info,)
58
59#return info
Note: See TracBrowser for help on using the repository browser.