- Timestamp:
- 27 Aug 2026, 07:34:00 (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/studylevel.py
r18235 r18307 21 21 """ 22 22 import grok 23 import decimal 23 24 from zope.component.interfaces import IFactory 24 25 from zope.interface import implementedBy … … 30 31 from kofacustom.unidel.students.interfaces import ( 31 32 ICustomStudentStudyLevel, ICustomCourseTicket) 33 from kofacustom.unidel.students.utils import MINIMUM_UNITS_THRESHOLD 32 34 33 35 … … 91 93 total_credits, credits_passed) 92 94 95 @property 96 def passed_params(self): 97 """Determine the number and credits of passed and failed courses. 98 This method is used for level reports. 99 """ 100 passed = failed = 0 101 courses_failed = '' 102 credits_failed = 0 103 credits_passed = 0 104 courses_not_taken = '' 105 courses_passed = '' 106 for ticket in self.values(): 107 if ticket.total_score is not None: 108 if ticket.total_score < ticket.passmark: 109 failed += 1 110 credits_failed += ticket.credits 111 if ticket.mandatory or ticket.course_category == 'C': 112 courses_failed += 'm_%s_m ' % ticket.code 113 else: 114 courses_failed += '%s ' % ticket.code 115 else: 116 passed += 1 117 credits_passed += ticket.credits 118 courses_passed += '%s ' % ticket.code 119 else: 120 courses_not_taken += '%s ' % ticket.code 121 if not len(courses_failed): 122 courses_failed = 'Nil' 123 if not len(courses_not_taken): 124 courses_not_taken = 'Nil' 125 return (passed, failed, credits_passed, 126 credits_failed, courses_failed, 127 courses_not_taken, courses_passed) 128 129 # only AAUE and Unidel 130 @property 131 def remark(self): 132 certificate = getattr(self.__parent__,'certificate',None) 133 end_level = getattr(certificate, 'end_level', None) 134 study_mode = getattr(certificate, 'study_mode', None) 135 tcrg = getattr(certificate, 'custom_float_1', None) 136 value = decimal.Decimal(str(self.cumulative_params[0])) 137 cgpa = round(value,2) 138 #cgpa = self.cumulative_params[0] 139 is_dp = False 140 if study_mode and study_mode.startswith('dp'): 141 is_dp = True 142 failed_limit = 1.5 143 if self.student.entry_session < 2013: 144 failed_limit = 1.0 145 # final level student remark 146 if end_level and self.level >= end_level: 147 if self.level > end_level: 148 # spill-over level 149 if self.gpa_params[1] == 0: 150 # no credits taken 151 return 'NER' 152 elif self.cumulative_params[4] < tcrg: 153 return 'FRNS' 154 if self.level_verdict in ('FRNS', 'NER', 'NYV'): 155 return self.level_verdict 156 if '_m' in self.passed_params[4]: 157 return 'FRNS' 158 if not self.cumulative_params[0]: 159 return 'FRNS' 160 if len(self.passed_params[5]) \ 161 and not self.passed_params[5] == 'Nil': 162 return 'FRNS' 163 if self.cumulative_params[1] < 60: 164 return 'FRNS' 165 if cgpa < failed_limit: 166 return 'Fail' 167 dummy, repeat = divmod(self.level, 100) 168 if cgpa < 5.1 and repeat == 20: 169 # Irrespective of the CGPA of a student, if the He/She has 170 # 3rd Extension, such student will be graduated with a "Pass". 171 return 'Pass' 172 if cgpa < 1.5: 173 if is_dp: 174 return 'Fail' 175 return 'Pass' 176 if cgpa < 2.4: 177 if is_dp: 178 return 'Pass' 179 return '3s_rd_s' 180 if cgpa < 3.5: 181 if is_dp: 182 return 'Merit' 183 return '2s_2_s' 184 if cgpa < 4.5: 185 if is_dp: 186 return 'Credit' 187 return '2s_1_s' 188 if cgpa < 5.1: 189 if is_dp: 190 return 'Distinction' 191 return '1s_st_s' 192 return 'N/A' 193 # returning student remark 194 if self.level_verdict in ('FRNS', 'NER', 'NYV'): 195 return 'Probation' 196 if self.level_verdict == 'D': 197 return 'Withdrawn' 198 if self.gpa_params[1] == 0: 199 # no credits taken 200 return 'NER' 201 if self.gpa_params[1] < MINIMUM_UNITS_THRESHOLD: 202 # credits taken below limit 203 return 'Probation' 204 if cgpa < failed_limit: 205 return 'Probation' 206 if cgpa < 5.1: 207 return 'Proceed' 208 return 'N/A' 209 93 210 CustomStudentStudyLevel = attrs_to_fields( 94 211 CustomStudentStudyLevel, omit=['total_credits', 'gpa',
Note: See TracChangeset for help on using the changeset viewer.
