## Script (Python) "getLecturerCourseResultsInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=course_id ##title= ## # $Id: getCoursesInfo.py 3482 2008-05-01 05:54:53Z henrik $ """ return Info about the Courses """ mtool = context.portal_membership member = mtool.getAuthenticatedMember() lec_id = member_id = str(member) if mtool.isAnonymousUser(): return None request = context.REQUEST path_info = request.get('PATH_INFO').split('/') info = {} info['lec_id'] = lec_id info['course_id'] = course_id res = context.course_results(code=course_id) items = [ brain for brain in res] rows = [] for r in items: row = {} if r['carry_over']: row['carry_over'] = 'CO' else: row['carry_over'] = '' row['credits'] = r['credits'] row['session_id'] = r['session_id'] row['level_id'] = level_id = r['level_id'] #row['score'] = r['score'] row['student_id'] = student_id = r['student_id'] student_record = context.students_catalog.getRecordByKey(student_id) row['student_record'] = context.getFormattedStudentEntry(student_record) row['url'] = "%s/campus/students/%s/study_course/%s" % (context.portal_url(),student_id,level_id) row['editable'] = not (r['ca1'] and r['ca2'] and r['atl'] and r['exam']) and row['student_record']['review_state'] == 'courses_validated' row['sort_dummy'] = row['student_record']['review_state'] rows.append(row) rows.sort(cmp=lambda x,y: cmp("%(session_id)s%(sort_dummy)s" % x, "%(session_id)s%(sort_dummy)s" % y)) info['students'] = rows return context.lecturer_students_list(info = info,) #return info