Ignore:
Timestamp:
1 Feb 2018, 11:57:38 (7 years ago)
Author:
Henrik Bettermann
Message:

Implement 'switch' to enable and disable displaying course results.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/interfaces.py

    r14700 r14944  
    269269        )
    270270
     271    show_results = schema.List(
     272        title = _(u'Show course results'),
     273        value_type = schema.Choice(
     274            source = EnableScoreEditingGroupSource(),
     275            ),
     276        required = False,
     277        defaultFactory=list,
     278        )
     279
    271280
    272281    def getSessionString():
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r14710 r14944  
    404404        isStudent = getattr(
    405405            self.request.principal, 'user_type', None) == 'student'
    406         # Temporarily disabled on 1/12/2016
    407         if isStudent:
     406        try:
     407            show_results = grok.getSite()[
     408                'configuration'][str(self.context.level_session)].show_results
     409        except KeyError:
    408410            return False
    409         #if isStudent and self.context.student.state != RETURNING \
    410         #    and self.context.student.current_level == self.context.level:
    411         #    return False
     411        if isStudent and self.context.student.current_mode not in show_results:
     412            return False
     413        if isStudent and self.context.student.state != RETURNING \
     414            and self.context.student.current_level == self.context.level:
     415            return False
    412416        return True
    413417
     
    447451        isStudent = getattr(
    448452            self.request.principal, 'user_type', None) == 'student'
    449         # Temporarily disabled on 1/12/2016
    450         if isStudent:
     453        try:
     454            show_results = grok.getSite()[
     455                'configuration'][str(self.context.level_session)].show_results
     456        except KeyError:
    451457            return False
    452         #if isStudent and self.context.student.state != RETURNING \
    453         #    and self.context.student.current_level == self.context.level:
    454         #    return False
     458        if isStudent and self.context.student.current_mode not in show_results:
     459            return False
     460        if isStudent and self.context.student.state != RETURNING \
     461            and self.context.student.current_level == self.context.level:
     462            return False
    455463        return True
    456464
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r14707 r14944  
    10421042        return
    10431043
     1044    def test_student_access_course_results(self):
     1045        IWorkflowState(self.student).setState('school fee paid')
     1046        self.student['studycourse'].entry_session = 2004
     1047        self.student['studycourse'].current_session = 2004
     1048        self.browser.open(self.login_path)
     1049        self.browser.getControl(name="form.login").value = self.student_id
     1050        self.browser.getControl(name="form.password").value = 'spwd'
     1051        self.browser.getControl("Login").click()
     1052        self.browser.getLink("Study Course").click()
     1053        self.browser.getLink("Add course list").click()
     1054        self.browser.getControl("Create course list now").click()
     1055        self.assertFalse('Score' in self.browser.contents)
     1056        IWorkflowState(self.student).setState('returning')
     1057        self.browser.open(self.studycourse_path + '/100')
     1058        self.assertFalse('Score' in self.browser.contents)
     1059        self.app['configuration']['2004'].show_results = ['ug_ft']
     1060        self.browser.open(self.studycourse_path + '/100')
     1061        self.assertTrue('Score' in self.browser.contents)
     1062        return
     1063
    10441064    def test_student_clearance(self):
    10451065        # Student cant login if their password is not set
Note: See TracChangeset for help on using the changeset viewer.