Ignore:
Timestamp:
11 May 2024, 07:45:54 (8 months ago)
Author:
Henrik Bettermann
Message:

Mangle referees and school grades.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py

    r16431 r17760  
    2323from waeup.kofa.applicants.interfaces import (
    2424    IApplicantBaseData, IApplicantsContainer, IApplicantOnlinePayment,
    25     IApplicantRefereeReport)
     25    IApplicantRefereeReport, IApplicant)
    2626from waeup.kofa.interfaces import ICSVExporter
    2727from waeup.kofa.interfaces import MessageFactory as _
     
    8080    grok.name('applicants')
    8181
    82     fields = tuple(sorted(iface_names(IApplicantBaseData))) + (
     82    fields = tuple(sorted(iface_names(IApplicant))) + (
    8383        'password', 'state', 'history', 'container_code', 'application_number',
    8484        'display_fullname', 'application_date')
     
    9393        if name.startswith('course') and value is not None:
    9494            value = value.code
    95         #elif name == 'school_grades':
    96         #    value = [eval(entry.to_string()) for entry in value]
     95        elif name == 'school_grades' and value is not None:
     96            value = [eval(entry.to_string()) for entry in value]
     97        elif name == 'referees' and value is not None:
     98            value = [eval(entry.to_string()) for entry in value]
    9799        elif name == 'history':
    98100            value = getattr(value, 'messages', None)
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r16976 r17760  
    1919from waeup.kofa.interfaces import ICSVExporter
    2020from waeup.kofa.schoolgrades import ResultEntry
     21from waeup.kofa.refereeentries import RefereeEntry
    2122from waeup.kofa.testing import KofaUnitTestLayer, FunctionalLayer
    2223from waeup.kofa.utils.utils import KofaUtils
     
    127128            KofaUtils.EXAM_GRADES[0][0]
    128129            )
    129         applicant.school_grades = [
    130             result_entry]
     130        applicant.school_grades = [result_entry]
     131        referee_entry = RefereeEntry(u'John Doe', 'john@aa.aa')
     132        applicant.referees = [referee_entry]
    131133        return applicant
    132134
     
    143145            'applicant_id,course1,course2,course_admitted,date_of_birth,'
    144146            'email,firstname,lastname,locked,middlename,notice,phone,'
    145             'reg_number,sex,special_application,student_id,suspended,'
    146             'password,state,history,container_code,application_number,'
    147             'display_fullname,application_date\r\n'
    148             'dp2011_654321,,,,,,Anna,Tester,0'
     147            'referees,reg_number,school_grades,sex,special_application,'
     148            'student_id,suspended,password,state,history,container_code,'
     149            'application_number,display_fullname,application_date\r\n'
     150            'dp2011_654321,,,,,,Anna,Tester'
    149151            in result)
    150152        self.assertTrue(
     
    166168            'applicant_id,course1,course2,course_admitted,date_of_birth,'
    167169            'email,firstname,lastname,locked,middlename,notice,phone,'
    168             'reg_number,sex,special_application,student_id,suspended,'
    169             'password,state,history,container_code,application_number,'
    170             'display_fullname,application_date\r\n'
     170            'referees,reg_number,school_grades,sex,special_application,'
     171            'student_id,suspended,password,state,history,container_code,'
     172            'application_number,display_fullname,application_date\r\n'
    171173            'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04#,'
    172174            'anna@sample.com,Anna,Tester,'
     
    189191            'applicant_id,course1,course2,course_admitted,date_of_birth,'
    190192            'email,firstname,lastname,locked,middlename,notice,phone,'
    191             'reg_number,sex,special_application,student_id,suspended,'
    192             'password,state,history,container_code,application_number,'
    193             'display_fullname,application_date\r\n'
     193            'referees,reg_number,school_grades,sex,special_application,'
     194            'student_id,suspended,password,state,history,container_code,'
     195            'application_number,display_fullname,application_date\r\n'
    194196            'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04#,'
    195197            'anna@sample.com,Anna,Tester,'
     
    198200            'Application initialized by system\'],dp2011,654321,'
    199201            'Anna M. Tester,\r\n'
     202            in result)
     203        self.assertTrue(
     204            '[(\'computer_science\', \'A\')]'
     205            in result)
     206        self.assertTrue(
     207            '[(u\'John Doe\', \'john@aa.aa\', False)]'
    200208            in result)
    201209        return
     
    210218            'applicant_id,course1,course2,course_admitted,date_of_birth,'
    211219            'email,firstname,lastname,locked,middlename,notice,phone,'
    212             'reg_number,sex,special_application,student_id,suspended,'
    213             'password,state,history,container_code,application_number,'
    214             'display_fullname,application_date\r\n'
     220            'referees,reg_number,school_grades,sex,special_application,'
     221            'student_id,suspended,password,state,history,container_code,'
     222            'application_number,display_fullname,application_date\r\n'
    215223            'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04#,'
    216224            'anna@sample.com,Anna,Tester,'
     
    230238            'applicant_id,course1,course2,course_admitted,date_of_birth,'
    231239            'email,firstname,lastname,locked,middlename,notice,phone,'
    232             'reg_number,sex,special_application,student_id,suspended,'
    233             'password,state,history,container_code,application_number,'
    234             'display_fullname,application_date\r\n'
     240            'referees,reg_number,school_grades,sex,special_application,'
     241            'student_id,suspended,password,state,history,container_code,'
     242            'application_number,display_fullname,application_date\r\n'
    235243            in result)
    236244        return
Note: See TracChangeset for help on using the changeset viewer.