Changeset 3612
- Timestamp:
- 7 Aug 2008, 10:10:29 (16 years ago)
- Location:
- WAeUP_SRP/unilorin/waeup_custom
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/unilorin/waeup_custom/getTranscriptInfo.py
r3602 r3612 18 18 """ 19 19 20 request = context.REQUEST 21 response = request.RESPONSE 22 import logging 23 logger = logging.getLogger('Skins.getTranscriptInfo') 20 24 info = context.waeup_tool.getAccessInfo(context) 21 25 student_id = info['student_id'] 22 26 if student_id is None: 23 27 return None 28 29 mtool = context.portal_membership 30 if mtool.isAnonymousUser() or not context.isSectionOfficer(): 31 return None 24 32 25 33 mtool = context.portal_membership … … 28 36 29 37 course_results = context.course_results 30 request = context.REQUEST31 response = request.RESPONSE32 import logging33 logger = logging.getLogger('Skins.getTranscriptInfo')34 38 35 39 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 40 student_record = context.students_catalog.getRecordByKey(student_id) 41 info['student_record'] = context.getFormattedStudentEntry(student_record) 57 42 58 43 44 year_courses = [[],[],[],[],[],[],[],[],[]] 45 year_details = [{'year':0},{'year':1},{'year':2},{'year':3},{'year':4},{'year':5},{'year':6},{'year':7},{'year':8}] 46 47 courses = course_results.getAllCourses(student_id) 48 49 for course in courses: 50 year = divmod(int(course['level_id']),100)[0] 51 year_courses[year].append(course) 52 if not getattr(year_details[year],'session',None): 53 year_details[year]['session'] = context.portal_vocabularies.sessions.get(course['session_id']) 54 55 year_counter = 0 56 for year in year_courses: 57 gpa = 0 58 total_credits = 0 59 for course in year: 60 gpa += int(course['weight']) * int(course['credits']) 61 total_credits += int(course['credits']) 62 if gpa and total_credits: 63 year_details[year_counter]['total_credits'] = total_credits 64 year_details[year_counter]['gpa'] = "%4.2f" % (float(gpa)/int(total_credits)) 65 year.sort(cmp=lambda x,y: cmp("%(semester)s%(code)s" % x, 66 "%(semester)s%(code)s" % y)) 67 year_counter += 1 68 69 info['year_details'] = year_details 70 info['year_courses'] = year_courses 71 59 72 return info 73 74
Note: See TracChangeset for help on using the changeset viewer.