Changeset 14436


Ignore:
Timestamp:
23 Jan 2017, 08:02:11 (8 years ago)
Author:
Henrik Bettermann
Message:

Add gpa and matric_number to CustomStudentStudyLevelExporter? field list.

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

    r14360 r14436  
    7272    fields = tuple(sorted(iface_names(
    7373        ICustomStudentStudyLevel))) + (
    74         'student_id', 'number_of_tickets','certcode')
     74        'student_id', 'matric_number', 'number_of_tickets','certcode', 'gpa')
     75
     76    def mangle_value(self, value, name, context=None):
     77        """The mangler determines the student id, nothing else.
     78        """
     79        if name in ('student_id', 'matric_number') and context is not None:
     80            student = context.student
     81            value = getattr(student, name, None)
     82        return super(
     83            CustomStudentStudyLevelExporter, self).mangle_value(
     84            value, name, context=context)
    7585
    7686class CustomStudentPaymentExporter(NigeriaStudentPaymentExporter):
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_export.py

    r14369 r14436  
    143143            'total_credits_s1,total_credits_s2,'
    144144            'validated_by,validation_date,'
    145             'student_id,number_of_tickets,certcode\r\n'
    146             '0.0,,,100,2012,A,100,,,,,A111111,1,CERT1\r\n'
     145            'student_id,matric_number,number_of_tickets,certcode,gpa\r\n'
     146            '0.0,,,100,2012,A,100,,,,,A111111,234,1,CERT1,0.0\r\n'
    147147            )
    148148        return
Note: See TracChangeset for help on using the changeset viewer.