Changeset 2988 for WAeUP_SRP/base/skins
- Timestamp:
- 7 Jan 2008, 18:57:27 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_student/create_level.py
r2977 r2988 64 64 #context.portal_workflow.doActionFor(level,'close_for_edit') 65 65 level_id = level.getId() 66 onprobation = context.getContent().previous_verdict in ('C',)67 66 session_id = context.getLevelSession(level.getContent(),student_id,level_id) 68 67 results = [] … … 72 71 l = [] 73 72 73 level_nr,dummy = divmod(int(current_level),100) 74 # fetch session courses from the certificate 75 res = context.portal_catalog(portal_type="Certificate", id = cert_id) 76 if res: 77 cert = res[0] 78 path = cert.getPath() 79 academics_level = 100 * level_nr 80 query = Eq("path","%s/%s" % (path,academics_level)) &\ 81 Eq('portal_type','CertificateCourse') 82 courses = aq_portal(query) 83 for c in courses: 84 course_id = "%s" % c.getId 85 if course_id in l: 86 # don't add twice 87 continue 88 l += course_id, 89 d = context.getCourseInfo(c.getId) 90 d['carry_over'] = False 91 d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') 92 d['course_id'] = course_id 93 d['student_id'] = student_id = context.getStudentId() 94 d['level_id'] = level_id 95 d['session_id'] = session_id 96 records.append(d) 74 97 # fetch carry_over courses from results_import 75 98 if student.session in ('6', '06') and results: … … 77 100 for co in carry_overs: 78 101 course_id = co.CosCode 79 if level.hasObject(course_id): #already created 102 if course_id in l: 103 # don't add twice 80 104 continue 105 # if level.hasObject(course_id): #already created 106 # continue 81 107 carry_over = False 82 108 query = Eq('code',co.CosCode) … … 102 128 if not carry_over: 103 129 continue 104 if course_id in l:105 # don't add twice106 continue107 130 l += course_id, 108 131 d = context.getCourseInfo(co.CosCode) … … 115 138 records.append(d) 116 139 # fetch carry_over courses from the course_results catalog 117 el if not onprobation:140 else: 118 141 res = aq_results(Eq('student_id',student_id), 119 142 sortSpecs=('level_id',)) 120 if res:121 last_level_id = res[-1].level_id122 143 for result in res: 123 144 course_id = result.code 124 if course_id in l or result.level_id != last_level_id:145 if course_id in l: 125 146 continue 126 147 query = Eq('code',course_id) … … 150 171 records.append(d) 151 172 152 # fetch session courses from the certificate153 res = context.portal_catalog(portal_type="Certificate", id = cert_id)154 if res:155 cert = res[0]156 path = cert.getPath()157 academics_level = 100 * (int(current_level)/100)158 query = Eq("path","%s/%s" % (path,academics_level)) &\159 Eq('portal_type','CertificateCourse')160 courses = aq_portal(query)161 for c in courses:162 course_id = "%s" % c.getId163 if course_id in l:164 # don't add twice165 continue166 l += course_id,167 d = context.getCourseInfo(c.getId)168 d['carry_over'] = False169 d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')170 d['course_id'] = course_id171 d['student_id'] = student_id = context.getStudentId()172 d['level_id'] = level_id173 d['session_id'] = session_id174 records.append(d)175 173 if records: 176 174 context.course_results.addMultipleRecords(records)
Note: See TracChangeset for help on using the changeset viewer.