Changeset 18325 for main/kofacustom.unidel
- Timestamp:
- 7 Sep 2026, 16:52:19 (3 months ago)
- Location:
- main/kofacustom.unidel/trunk/src/kofacustom/unidel
- Files:
-
- 1 added
- 4 edited
-
interfaces.py (modified) (1 diff)
-
students/browser.py (modified) (4 diffs)
-
students/browser_templates/courseticketpage.pt (added)
-
students/browser_templates/studylevelpage.pt (modified) (2 diffs)
-
students/tests/test_browser.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.unidel/trunk/src/kofacustom/unidel/interfaces.py
r18313 r18325 207 207 ) 208 208 209 show_results = schema.List( 210 title = _(u'Show course results'), 211 value_type = schema.Choice( 212 source = EnableScoreEditingGroupSource(), 213 ), 214 required = False, 215 defaultFactory=list, 216 ) 217 209 218 def getSessionString(): 210 219 """Returns the session string from the vocabulary. -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py
r18323 r18325 314 314 'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 315 315 316 @property 317 def show_results(self): 318 isStudent = getattr( 319 self.request.principal, 'user_type', None) == 'student' 320 try: 321 show_results = grok.getSite()[ 322 'configuration'][str(self.context.level_session)].show_results 323 except KeyError: 324 return False 325 if isStudent and self.context.student.current_mode not in show_results: 326 return False 327 #if isStudent and self.context.student.state != RETURNING \ 328 # and self.context.student.current_level == self.context.level: 329 # return False 330 return True 331 316 332 class CustomStudyLevelManageFormPage(StudyLevelManageFormPage): 317 333 """ Page to edit the student study level data … … 338 354 'adm_code', 'sex', 'suspended_comment', 'current_level', 339 355 'flash_notice', 'imported_gpa', 'imported_cgpa',) 356 357 @property 358 def show_results(self): 359 isStudent = getattr( 360 self.request.principal, 'user_type', None) == 'student' 361 try: 362 show_results = grok.getSite()[ 363 'configuration'][str(self.context.level_session)].show_results 364 except KeyError: 365 return False 366 if isStudent and self.context.student.current_mode not in show_results: 367 return False 368 if isStudent and self.context.student.state != RETURNING \ 369 and self.context.student.current_level == self.context.level: 370 return False 371 return True 340 372 341 373 def _signatures(self): … … 375 407 if value.semester == i and not value.outstanding], 376 408 key=lambda value: str(value.semester) + value.code)) 377 tableheader.append([(Code,'code', 2.0), 378 (Title,'title', 7), 379 (Cred, 'credits', 1.4), 380 #(CC, 'course_category', 1.2), 381 (TotalScore, 'total_score', 1.4), 382 #(CA, 'ca', 1.4), 383 (Grade, 'grade', 1.4), 384 (Signature, 'dummy', 3), 385 ]) 409 if self.show_results: 410 tableheader.append([(Code,'code', 2.0), 411 (Title,'title', 7), 412 (Cred, 'credits', 1.4), 413 (CC, 'course_category', 1.2), 414 (TotalScore, 'total_score', 1.4), 415 #(CA, 'ca', 1.4), 416 (Grade, 'grade', 1.4), 417 (Signature, 'dummy', 3), 418 ]) 419 else: 420 tableheader.append([(Code,'code', 2.0), 421 (Title,'title', 7), 422 (Cred, 'credits', 1.5), 423 (CC, 'course_category', 1.2), 424 (Signature, 'dummy', 3), 425 ]) 386 426 return students_utils.renderPDF( 387 427 self, 'course_registration_slip.pdf', … … 399 439 400 440 @property 441 def show_results(self): 442 isStudent = getattr( 443 self.request.principal, 'user_type', None) == 'student' 444 if isStudent: 445 return False 446 return True 447 448 @property 401 449 def form_fields(self): 402 return grok.AutoFields(ICustomCourseTicket).omit('course_category', 450 if self.show_results: 451 return grok.AutoFields(ICustomCourseTicket).omit('course_category', 403 452 'ticket_session') 453 else: 454 return grok.AutoFields(ICustomCourseTicket).omit('score', 'ca', 455 'course_category', 'ticket_session') 404 456 405 457 class CustomCourseTicketManageFormPage(CourseTicketManageFormPage): -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser_templates/studylevelpage.pt
r17026 r18325 28 28 <th i18n:translate="">Cred.</th> 29 29 <th i18n:translate="">Requ.</th> 30 <th i18n:translate="" >Score</th>31 <th i18n:translate="" >Grade</th>30 <th i18n:translate="" tal:condition="view/show_results" >Total Score</th> 31 <th i18n:translate="" tal:condition="view/show_results" >Grade</th> 32 32 <th i18n:translate="">CO</th> 33 33 <th i18n:translate="">OS</th> … … 46 46 <td tal:content="value/credits">CREDITS</td> 47 47 <td tal:content="value/mandatory">MANDATORY</td> 48 <td tal:con tent="value/total_score|nothing">SCORE</td>49 <td tal:con tent="value/grade|nothing">GRADE</td>48 <td tal:condition="view/show_results" tal:content="structure value/formatted_total_score|nothing">TOTALSCORE</td> 49 <td tal:condition="view/show_results" tal:content="value/grade|nothing">GRADE</td> 50 50 <td tal:content="value/carry_over">CO</td> 51 51 <td tal:content="value/outstanding">OS</td> -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/tests/test_browser.py
r18317 r18325 306 306 open(path, 'wb').write(self.browser.contents) 307 307 print "Sample PDF attendance.pdf written to %s" % path 308 309 310 class StudentUITests(StudentsFullSetup): 311 """Tests for customized student class views and pages 312 """ 313 314 layer = FunctionalLayer 315 316 def setUp(self): 317 super(StudentUITests, self).setUp() 318 self.app['faculties']['fac1']['dep1'].certificates[ 319 'CERT1']['COURSE1_100'].course_category = 'C' 320 bedticket = BedTicket() 321 bedticket.booking_session = 2004 322 bedticket.bed_type = u'any bed type' 323 bedticket.bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] 324 bedticket.bed_coordinates = u'My bed coordinates' 325 self.student['accommodation'].addBedTicket(bedticket) 326 327 def test_student_access_course_results(self): 328 IWorkflowState(self.student).setState('school fee paid') 329 self.student['studycourse'].entry_session = 2004 330 self.student['studycourse'].current_session = 2004 331 self.browser.open(self.login_path) 332 self.browser.getControl(name="form.login").value = self.student_id 333 self.browser.getControl(name="form.password").value = 'spwd' 334 self.browser.getControl("Login").click() 335 self.browser.getLink("Study Course").click() 336 self.browser.getLink("Add course list").click() 337 self.browser.getControl("Create course list now").click() 338 self.assertFalse('Score' in self.browser.contents) 339 IWorkflowState(self.student).setState('returning') 340 self.browser.open(self.studycourse_path + '/100') 341 self.assertFalse('Score' in self.browser.contents) 342 self.app['configuration']['2004'].show_results = ['ug_ft'] 343 self.browser.open(self.studycourse_path + '/100') 344 self.assertTrue('Score' in self.browser.contents) 345 return
Note: See TracChangeset for help on using the changeset viewer.
