1 | ## Script (Python) "getTranscriptInfo"
|
---|
2 | ##bind container=container
|
---|
3 | ##bind context=context
|
---|
4 | ##bind namespace=
|
---|
5 | ##bind script=script
|
---|
6 | ##bind subpath=traverse_subpath
|
---|
7 | ##parameters=student=None
|
---|
8 | ##title=
|
---|
9 | ##
|
---|
10 | # $Id: getStudyLevelInfo.py 2760 2007-11-26 07:39:15Z henrik $
|
---|
11 | """
|
---|
12 | return Info about the Studylevel
|
---|
13 | try:
|
---|
14 | from Products.zdb import set_trace
|
---|
15 | except:
|
---|
16 | def set_trace():
|
---|
17 | pass
|
---|
18 | """
|
---|
19 |
|
---|
20 | info = context.waeup_tool.getAccessInfo(context)
|
---|
21 | student_id = info['student_id']
|
---|
22 | if student_id is None:
|
---|
23 | return None
|
---|
24 |
|
---|
25 | mtool = context.portal_membership
|
---|
26 | member = mtool.getAuthenticatedMember()
|
---|
27 | member_id = str(member)
|
---|
28 |
|
---|
29 | course_results = context.course_results
|
---|
30 | request = context.REQUEST
|
---|
31 | response = request.RESPONSE
|
---|
32 | import logging
|
---|
33 | logger = logging.getLogger('Skins.getTranscriptInfo')
|
---|
34 |
|
---|
35 |
|
---|
36 | info['is_so'] = is_so = info['is_sectionofficer']
|
---|
37 | info['student'] = student = context.students_catalog.getRecordByKey(student_id)
|
---|
38 | info['review_state'] = review_state = student.review_state
|
---|
39 | school_fee_paid = review_state == 'school_fee_paid'
|
---|
40 | info['has_verdict'] = has_verdict = level_doc.verdict
|
---|
41 |
|
---|
42 | info['verdict'] = context.portal_vocabularies.verdicts.get(level_doc.verdict).upper()
|
---|
43 | info['session'] = context.portal_vocabularies.sessions.get(level_doc.session)
|
---|
44 |
|
---|
45 | cert_id = student.course
|
---|
46 | info['cert_id'] = cert_id
|
---|
47 | total_credits,gpa,carry_overs,normal1,normal2,normal3 = course_results.getCourses(student_id,level_id)
|
---|
48 | info['total_credits'] = total_credits
|
---|
49 |
|
---|
50 | current_session = student.session
|
---|
51 | info['gpa'] = gpa
|
---|
52 |
|
---|
53 | if gpa and total_credits:
|
---|
54 | info['gpa'] = "%4.2f" % (float(gpa)/int(total_credits))
|
---|
55 |
|
---|
56 | info['carry_overs'] = carry_overs
|
---|
57 |
|
---|
58 |
|
---|
59 | return info |
---|