Changeset 14701 for main


Ignore:
Timestamp:
24 Jun 2017, 08:54:57 (7 years ago)
Author:
Henrik Bettermann
Message:

Add fields to CustomDataForLecturerExporter?.

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

Legend:

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

    r14622 r14701  
    115115
    116116    fields = ('matric_number', 'student_id','display_fullname',
    117               'level', 'code', 'level_session', 'ca', 'score')
     117              'depcode', 'faccode',
     118              'level', 'code', 'level_session', 'ca', 'score',
     119              'total_score', 'grade')
     120
     121    def mangle_value(self, value, name, context=None):
     122        """The mangler determines the student's id and fullname.
     123        """
     124        if context is not None:
     125            student = context.student
     126            if name in ('matric_number',
     127                        'reg_number',
     128                        'student_id',
     129                        'display_fullname',
     130                        'depcode',
     131                        'faccode') and student is not None:
     132                value = getattr(student, name, None)
     133        return super(
     134            DataForLecturerExporter, self).mangle_value(
     135            value, name, context=context)
    118136
    119137class LevelReportDataExporter(grok.GlobalUtility, StudentExporterBase):
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r14700 r14701  
    392392        self.assertEqual(self.browser.headers['Content-Type'],
    393393                         'text/csv; charset=UTF-8')
    394         self.assertEqual(self.browser.contents, 'matric_number,student_id,display_fullname,'
    395             'level,code,level_session,ca,score\r\n234,E1000000,"TESTER, Anna",'
    396             '100,COURSE1,2003,,55\r\n')
     394        self.assertEqual(self.browser.contents,
     395            'matric_number,student_id,display_fullname,'
     396            'depcode,faccode,level,code,level_session,ca,score,'
     397            'total_score,grade\r\n234,E1000000,"TESTER, Anna",dep1,fac1,'
     398            '100,COURSE1,2003,,55,,\r\n')
    397399        self.browser.open(self.edit_prev_scores_url)
    398400        upload_ctrl = self.browser.getControl(name='uploadfile:file')
Note: See TracChangeset for help on using the changeset viewer.