Changeset 14000 for main


Ignore:
Timestamp:
30 Jun 2016, 09:23:19 (8 years ago)
Author:
Henrik Bettermann
Message:

Show course results only if students are returning or current level is different from course level.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
4 edited

Legend:

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

    r13997 r14000  
    2929from waeup.kofa.interfaces import IKofaUtils, academic_sessions_vocab
    3030from waeup.kofa.students.interfaces import IStudentsUtils, IStudent
    31 from waeup.kofa.students.workflow import PAID, REGISTERED
     31from waeup.kofa.students.workflow import PAID, REGISTERED, RETURNING
    3232from waeup.kofa.students.studylevel import getGradeWeightFromScore
    3333from waeup.kofa.students.browser import (
     
    212212        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    213213
     214    @property
     215    def show_results(self):
     216        isStudent = getattr(
     217            self.request.principal, 'user_type', None) == 'student'
     218        if isStudent and self.context.student.state != RETURNING \
     219            and self.context.student.current_level == self.context.level:
     220            return False
     221        return True
     222
    214223class CustomStudyLevelManageFormPage(StudyLevelManageFormPage):
    215224    """ Page to edit the student study level data
     
    234243        'phone', 'adm_code', 'sex', 'email', 'date_of_birth',
    235244        'department', 'current_mode', 'current_level', 'flash_notice')
     245
     246    @property
     247    def show_results(self):
     248        isStudent = getattr(
     249            self.request.principal, 'user_type', None) == 'student'
     250        return not isStudent \
     251            or self.context.student.current_level != self.context.level \
     252            or self.context.student.state == RETURNING
    236253
    237254    def update(self):
     
    240257            self.flash(_('Forbidden'), type="warning")
    241258            self.redirect(self.url(self.context))
     259            return
    242260
    243261    @property
     
    305323        Title = translate(_('Title'), target_language=portal_language)
    306324        Cred = translate(_('Cred.'), target_language=portal_language)
    307         Score = translate(_('Score'), target_language=portal_language)
    308         #CA = translate(_('CA'), target_language=portal_language)
    309         Grade = translate(_('Grade'), target_language=portal_language)
     325        if self.show_results:
     326            Score = translate(_('Score'), target_language=portal_language)
     327            #CA = translate(_('CA'), target_language=portal_language)
     328            Grade = translate(_('Grade'), target_language=portal_language)
    310329        Signature = translate(_('Lecturer\'s Signature'), 'waeup.aaue',
    311330            target_language=portal_language)
     
    321340                [value for value in self.context.values() if value.semester == i],
    322341                key=lambda value: str(value.semester) + value.code))
    323             tableheader.append([(Code,'code', 2.0),
    324                                (Title,'title', 7),
    325                                (Cred, 'credits', 1.5),
    326                                (Score, 'score', 1.4),
    327                                #(CA, 'ca', 1.4),
    328                                (Grade, 'grade', 1.4),
    329                                (Signature, 'dummy', 3),
    330                                ])
     342            if self.show_results:
     343                tableheader.append([(Code,'code', 2.0),
     344                                   (Title,'title', 7),
     345                                   (Cred, 'credits', 1.5),
     346                                   (Score, 'score', 1.4),
     347                                   #(CA, 'ca', 1.4),
     348                                   (Grade, 'grade', 1.4),
     349                                   (Signature, 'dummy', 3),
     350                                   ])
     351            else:
     352                tableheader.append([(Code,'code', 2.0),
     353                                   (Title,'title', 7),
     354                                   (Cred, 'credits', 1.5),
     355                                   (Signature, 'dummy', 3),
     356                                   ])
    331357        if len(self.label.split('\n')) == 3:
    332358            topMargin = 1.9
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser_templates/studyleveleditpage.pt

    r13937 r14000  
    1818      <th i18n:translate="">Faculty</th>
    1919      <th i18n:translate="">Credits</th>
    20       <th i18n:translate="">Score</th>
    21       <th i18n:translate="">CA</th>
    2220      <th i18n:translate="">CO</th>
    2321    </tr>
     
    3836      <td tal:content="value/fcode">FACULTY</td>
    3937      <td tal:content="value/credits">CREDITS</td>
    40       <td tal:content="value/score|nothing">SCORE</td>
    41       <td tal:content="value/ca|nothing">CA</td>
    4238      <td tal:content="value/carry_over">CO</td>
    4339    </tr>
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser_templates/studylevelpage.pt

    r13834 r14000  
    4646      <td tal:content="value/credits">CREDITS</td>
    4747      <td tal:content="value/mandatory">MANDATORY</td>
    48       <td tal:content="value/score|nothing">SCORE</td>
    49       <td tal:content="value/ca|nothing">CA</td>
    50       <td tal:content="value/grade|nothing">GRADE</td>
    51       <td tal:content="value/carry_over">CO</td>
     48      <td tal:condition="view/show_results" tal:content="value/score|nothing">SCORE</td>
     49      <td tal:condition="view/show_results" tal:content="value/ca|nothing">CA</td>
     50      <td tal:condition="view/show_results" tal:content="value/grade|nothing">GRADE</td>
     51      <td tal:condition="view/show_results" tal:content="value/carry_over">CO</td>
    5252      <td tal:content="value/automatic">AUTO</td>
    5353    </tr>
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13964 r14000  
    441441                           self.browser.contents)
    442442        self.browser.getControl("Create course list now").click()
     443        self.student['studycourse']['100']['COURSE1'].score = 987
    443444        self.browser.getLink("100").click()
     445        # Course results can't be seen
     446        self.assertFalse('987' in self.browser.contents)
    444447        self.browser.getLink("Edit course list").click()
     448        self.assertFalse('987' in self.browser.contents)
    445449        self.browser.getControl("Register course list").click()
    446450        self.assertTrue('Course registration has ended. Please pay' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.