Changeset 9828 for main/waeup.kofa/trunk/src/waeup/kofa/university
- Timestamp:
- 5 Jan 2013, 17:26:01 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/university
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/university/certcourses.txt
r8920 r9828 115 115 >>> list(fac['DEPT2'].courses) 116 116 [u'CRS2'] 117 118 If a single course is registered for several levels in a single 119 certificate, this will not block things if the course is removed 120 (regression test): 121 122 We add the same course as a reference for level 200 and level 300: 123 124 >>> fac['DEPT'].certificates['CERT'].addCertCourse( 125 ... fac['DEPT2'].courses['CRS2'], level=200) 126 >>> fac['DEPT'].certificates['CERT'].addCertCourse( 127 ... fac['DEPT2'].courses['CRS2'], level=300) 128 129 Deleting the course (thus also the refererrers) will work: 130 131 >>> del root['app']['faculties']['FAC']['DEPT2'].courses['CRS2'] 132 133 Now all references are gone: 134 135 >>> list(a.certificates['CERT']) 136 [] 137 138 and also the course itself vanished: 139 140 >>> list(fac['DEPT2'].courses) 141 [] -
main/waeup.kofa/trunk/src/waeup/kofa/university/course.py
r9826 r9828 83 83 84 84 results = cat.searchResults(course_code=(code, code)) 85 # Only one certcourse per certificate is needed 86 reduced_results = [] 87 for certcourse in results: 88 cert = certcourse.__parent__ 89 if cert in [i.__parent__ for i in reduced_results]: 90 continue 91 reduced_results.append(certcourse) 92 # Now we can apply delCertCourses 93 for certcourse in reduced_results: 94 cert = certcourse.__parent__ 85 86 # remove each found referrer (certs might refer to same course multiple 87 # times) 88 certs = [x.__parent__ for x in results] 89 unique_certs = list(set(certs)) 90 for cert in unique_certs: 95 91 cert.delCertCourses(code) 96 92 return
Note: See TracChangeset for help on using the changeset viewer.