Changeset 16907 for main/waeup.aaue
- Timestamp:
- 25 Mar 2022, 18:49:53 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/studycourse.py
r14384 r16907 22 22 import grok 23 23 from zope.interface import implementedBy 24 from zope.component import createObject 24 25 from waeup.kofa.students.studycourse import StudentStudyCourseFactory 25 26 from waeup.kofa.utils.helpers import attrs_to_fields 26 from waeup.kofa.students.interfaces import IStudentNavigation 27 from waeup.kofa.students.interfaces import ( 28 IStudentNavigation, IStudentStudyLevel) 27 29 from waeup.kofa.students.workflow import CLEARED, RETURNING, PAID 28 30 from kofacustom.nigeria.students.studycourse import NigeriaStudentStudyCourse … … 48 50 return self.is_postgrad 49 51 52 def addStudentStudyLevel(self, cert, studylevel, course_category=None): 53 """Add a study level object. 54 """ 55 if not IStudentStudyLevel.providedBy(studylevel): 56 raise TypeError( 57 'StudentStudyCourses contain only IStudentStudyLevel instances') 58 self[str(studylevel.level)] = studylevel 59 #studylevel.addCertCourseTickets(cert) 60 # Collect carry-over courses in base levels (not in repeating levels) 61 try: 62 co_enabled = grok.getSite()['configuration'].carry_over 63 except TypeError: 64 # In tests we might not have a site object 65 co_enabled = True 66 if not co_enabled or studylevel.level % 100 != 0: 67 return 68 levels = sorted(self.keys()) 69 index = levels.index(str(studylevel.level)) 70 co_ticket = None 71 if index > 0: 72 previous_level = self[levels[index-1]] 73 for key, val in previous_level.items(): 74 if val.total_score >= val.passmark: 75 continue 76 if course_category and val.course_category != course_category: 77 continue 78 if key in self[str(studylevel.level)]: 79 # Carry-over ticket exists 80 continue 81 co_ticket = createObject(u'waeup.CourseTicket') 82 for name in ['code', 'title', 'credits', 'passmark', 83 'semester', 'mandatory', 'fcode', 'dcode', 84 'course_category']: 85 setattr(co_ticket, name, getattr(val, name)) 86 co_ticket.automatic = True 87 co_ticket.carry_over = True 88 self[str(studylevel.level)][co_ticket.code] = co_ticket 89 # AAUE modifaction: Add cert courses tickets only if no carry-over 90 # ticket has been found 91 if not co_ticket: 92 studylevel.addCertCourseTickets(cert) 93 return 94 95 50 96 CustomStudentStudyCourse = attrs_to_fields(CustomStudentStudyCourse) 51 97
Note: See TracChangeset for help on using the changeset viewer.