Changeset 9257 for main/waeup.kofa/trunk
- Timestamp:
- 28 Sep 2012, 19:47:52 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9255 r9257 2002 2002 emit_lock_message(self) 2003 2003 return 2004 if self.context.student.state != PAID: 2004 if self.context.student.state != PAID or \ 2005 not self.context.is_current_level: 2005 2006 emit_lock_message(self) 2006 2007 return … … 2084 2085 2085 2086 def update(self): 2086 if self.context.student.state != PAID: 2087 if self.context.student.state != PAID or \ 2088 not self.context.is_current_level: 2087 2089 emit_lock_message(self) 2088 2090 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r9253 r9257 430 430 number_of_tickets = Attribute('Number of tickets contained in this level') 431 431 certcode = Attribute('The certificate code of the study course') 432 is_current_level = Attribute('Is this level the current level of the student?') 432 433 433 434 level_session = schema.Choice( -
main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py
r9253 r9257 56 56 def number_of_tickets(self): 57 57 return len(self) 58 59 @property 60 def is_current_level(self): 61 try: 62 return self.__parent__.current_level == self.level 63 except AttributeError: 64 return False 58 65 59 66 def writeLogMessage(self, view, message): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9255 r9257 2063 2063 'K1000000 - account activated' in logcontent) 2064 2064 2065 def test_student_transfer(self): 2065 def test_student_locked_level_forms(self): 2066 2067 # Add two study levels, one current and one previous 2068 studylevel = createObject(u'waeup.StudentStudyLevel') 2069 studylevel.level = 100 2070 self.student['studycourse'].addStudentStudyLevel( 2071 self.certificate, studylevel) 2072 studylevel = createObject(u'waeup.StudentStudyLevel') 2073 studylevel.level = 200 2074 self.student['studycourse'].addStudentStudyLevel( 2075 self.certificate, studylevel) 2076 IWorkflowState(self.student).setState('school fee paid') 2077 self.student['studycourse'].current_level = 200 2078 2079 self.browser.open(self.login_path) 2080 self.browser.getControl(name="form.login").value = self.student_id 2081 self.browser.getControl(name="form.password").value = 'spwd' 2082 self.browser.getControl("Login").click() 2083 2084 self.browser.open(self.student_path + '/studycourse/200/edit') 2085 self.assertFalse('The requested form is locked' in self.browser.contents) 2086 self.browser.open(self.student_path + '/studycourse/100/edit') 2087 self.assertTrue('The requested form is locked' in self.browser.contents) 2088 2089 self.browser.open(self.student_path + '/studycourse/200/ctadd') 2090 self.assertFalse('The requested form is locked' in self.browser.contents) 2091 self.browser.open(self.student_path + '/studycourse/100/ctadd') 2092 self.assertTrue('The requested form is locked' in self.browser.contents) 2093 2094 IWorkflowState(self.student).setState('courses registered') 2095 self.browser.open(self.student_path + '/studycourse/200/edit') 2096 self.assertTrue('The requested form is locked' in self.browser.contents) 2097 self.browser.open(self.student_path + '/studycourse/200/ctadd') 2098 self.assertTrue('The requested form is locked' in self.browser.contents) 2099 2100 2101 def test_manage_student_transfer(self): 2066 2102 # Add second certificate 2067 2103 self.certificate2 = createObject('waeup.Certificate') … … 2076 2112 studylevel = createObject(u'waeup.StudentStudyLevel') 2077 2113 studylevel.level = 200 2114 self.student['studycourse'].addStudentStudyLevel( 2115 self.certificate, studylevel) 2116 studylevel = createObject(u'waeup.StudentStudyLevel') 2117 studylevel.level = 999 2078 2118 self.student['studycourse'].addStudentStudyLevel( 2079 2119 self.certificate, studylevel) … … 2104 2144 # Add study level to new study course 2105 2145 studylevel = createObject(u'waeup.StudentStudyLevel') 2106 studylevel.level = 2002146 studylevel.level = 999 2107 2147 self.student['studycourse'].addStudentStudyLevel( 2108 2148 self.certificate, studylevel) … … 2125 2165 self.assertTrue('The requested form is locked' in self.browser.contents) 2126 2166 2127 self.browser.open(self.student_path + '/studycourse/ 200/manage')2167 self.browser.open(self.student_path + '/studycourse/999/manage') 2128 2168 self.assertFalse('The requested form is locked' in self.browser.contents) 2129 self.browser.open(self.student_path + '/studycourse_1/ 200/manage')2169 self.browser.open(self.student_path + '/studycourse_1/999/manage') 2130 2170 self.assertTrue('The requested form is locked' in self.browser.contents) 2131 2171 2132 self.browser.open(self.student_path + '/studycourse/ 200/validate_courses')2172 self.browser.open(self.student_path + '/studycourse/999/validate_courses') 2133 2173 self.assertFalse('The requested form is locked' in self.browser.contents) 2134 self.browser.open(self.student_path + '/studycourse_1/ 200/validate_courses')2174 self.browser.open(self.student_path + '/studycourse_1/999/validate_courses') 2135 2175 self.assertTrue('The requested form is locked' in self.browser.contents) 2136 2176 2137 self.browser.open(self.student_path + '/studycourse/ 200/reject_courses')2177 self.browser.open(self.student_path + '/studycourse/999/reject_courses') 2138 2178 self.assertFalse('The requested form is locked' in self.browser.contents) 2139 self.browser.open(self.student_path + '/studycourse_1/ 200/reject_courses')2179 self.browser.open(self.student_path + '/studycourse_1/999/reject_courses') 2140 2180 self.assertTrue('The requested form is locked' in self.browser.contents) 2141 2181 2142 self.browser.open(self.student_path + '/studycourse/ 200/add')2182 self.browser.open(self.student_path + '/studycourse/999/add') 2143 2183 self.assertFalse('The requested form is locked' in self.browser.contents) 2144 self.browser.open(self.student_path + '/studycourse_1/ 200/add')2184 self.browser.open(self.student_path + '/studycourse_1/999/add') 2145 2185 self.assertTrue('The requested form is locked' in self.browser.contents) 2146 2186 2147 self.browser.open(self.student_path + '/studycourse/ 200/edit')2187 self.browser.open(self.student_path + '/studycourse/999/edit') 2148 2188 self.assertFalse('The requested form is locked' in self.browser.contents) 2149 self.browser.open(self.student_path + '/studycourse_1/ 200/edit')2189 self.browser.open(self.student_path + '/studycourse_1/999/edit') 2150 2190 self.assertTrue('The requested form is locked' in self.browser.contents) 2151 2191 -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r9237 r9257 565 565 def target_url(self): 566 566 student = self.view.context.student 567 condition1 = student.state != PAID 568 condition2 = student[ 569 'studycourse'].current_level != self.view.context.level 567 condition1 = student.state == PAID 568 condition2 = self.view.context.is_current_level 570 569 is_current = self.context.__parent__.is_current 571 if condition1 or condition2 or notis_current:572 return ''573 return self.view.url(self.view.context, self.target)570 if condition1 and condition2 and is_current: 571 return self.view.url(self.view.context, self.target) 572 return '' 574 573 575 574 class StudentsTab(PrimaryNavTab):
Note: See TracChangeset for help on using the changeset viewer.