Changeset 15228 for main


Ignore:
Timestamp:
11 Nov 2018, 10:13:56 (6 years ago)
Author:
Henrik Bettermann
Message:

Show imported total scores in bold.

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

Legend:

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

    r15226 r15228  
    9191grok.context(IKofaObject)  # Make IKofaObject the default context
    9292
     93def translated_values(view):
     94    """Translate course ticket attribute values to be displayed on
     95    studylevel pages.
     96    """
     97    lang = view.request.cookies.get('kofa.language')
     98    for value in view.context.values():
     99        value._p_activate()
     100        value_dict = dict([i for i in value.__dict__.items()])
     101        value_dict['url'] = view.url(value)
     102        value_dict['removable_by_student'] = value.removable_by_student
     103        value_dict['mandatory'] = translate(str(value.mandatory), 'zope',
     104            target_language=lang)
     105        value_dict['carry_over'] = translate(str(value.carry_over), 'zope',
     106            target_language=lang)
     107        value_dict['outstanding'] = translate(str(value.outstanding), 'zope',
     108            target_language=lang)
     109        value_dict['automatic'] = translate(str(value.automatic), 'zope',
     110            target_language=lang)
     111        value_dict['grade'] = value.grade
     112        value_dict['weight'] = value.weight
     113        value_dict['course_category'] = value.course_category
     114        value_dict['total_score'] = value.total_score
     115        semester_dict = getUtility(IKofaUtils).SEMESTER_DICT
     116        value_dict['semester'] = semester_dict[
     117            value.semester].replace('mester', 'm.')
     118        # AAUE specific
     119        value_dict['formatted_total_score'] = value.total_score
     120        if getattr(value, 'imported_ts', None):
     121            value_dict['formatted_total_score'] = "<strong>%s</strong>" % value.imported_ts
     122        yield value_dict
     123
    93124class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage):
    94125    """ Page to display student base data
     
    444475    form_fields[
    445476        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     477
     478    @property
     479    def translated_values(self):
     480        return translated_values(self)
    446481
    447482    @property
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser_templates/studylevelpage.pt

    r14947 r15228  
    4343      <td tal:content="value/credits">CREDITS</td>
    4444      <td tal:content="value/mandatory">MANDATORY</td>
    45       <td tal:condition="view/show_results" tal:content="value/total_score|nothing">TOTALSCORE</td>
     45      <td tal:condition="view/show_results" tal:content="structure value/formatted_total_score|nothing">TOTALSCORE</td>
    4646      <td tal:condition="view/show_results" tal:content="value/grade|nothing">GRADE</td>
    4747      <td tal:content="value/carry_over">CO</td>
  • main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py

    r15226 r15228  
    406406    @property
    407407    def total_score(self):
    408         """Returns ca + score.
     408        """Returns ca + score or imported total score.
    409409        """
    410410        # Override total_score if value has been imported
Note: See TracChangeset for help on using the changeset viewer.