Changeset 17834 for main/waeup.uniben


Ignore:
Timestamp:
8 Jul 2024, 15:48:12 (4 months ago)
Author:
Henrik Bettermann
Message:

Improve NYSCExporter.

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

Legend:

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

    r17828 r17834  
    10891089        form_fields = grok.AutoFields(INYSC)
    10901090        form_fields['nysc_updated'].for_display = True
    1091         form_fields['nysc_senate_info'].for_display = True
     1091        #form_fields['nysc_senate_info'].for_display = True
    10921092        form_fields['nysc'].field.description = u'Ensure that all your school charges are paid up to date to your graduating session before making this nysc application.'
    10931093        form_fields['nysc'].field.title = u'Do you want to apply for NYSC?'
     
    10951095            'nysc_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    10961096        form_fields['nysc'].custom_widget = CustomBooleanRadioWidget
    1097         form_fields['nysc_senate_info'].field.description = u''
     1097        form_fields['nysc_senate_info'].field.description = u'Sample: Meeting Date: 10TH MAY 2023. DEG CLASS: FIRST CLASS. S/NO: 01'
     1098        #form_fields['nysc_senate_info'].field.description = u''
    10981099        return form_fields
    10991100
  • main/waeup.uniben/trunk/src/waeup/uniben/students/export.py

    r17831 r17834  
    194194        'date_of_birth',
    195195        'state',
     196        'lg_state',
     197        'lg_area',
    196198        'current_mode',
    197199        'certcode',
     
    217219                students.append(student)
    218220        return students
     221
     222    def mangle_value(self, value, name, context=None):
     223        if name == 'lg_state' and context.lga:
     224            value = context.lga.split('_')[0]
     225        if name == 'lg_area' and context.lga:
     226            value = '-'.join(context.lga.split('_')[1:])
     227        return super(
     228            NYSCExporter, self).mangle_value(
     229            value, name, context=context)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py

    r17827 r17834  
    178178        self.setup_student(self.student)
    179179        self.student.nysc = True
     180        self.student.lga = u'xyz_abc'
    180181        exporter = NYSCExporter()
    181182        exporter.export_all(self.app, self.outfile)
     
    183184        self.assertMatches(
    184185            'student_id,matric_number,reg_number,firstname,middlename,lastname,'
    185             'sex,nationality,date_of_birth,state,current_mode,certcode,faccode,'
     186            'sex,nationality,date_of_birth,state,lg_state,lg_area,current_mode,certcode,faccode,'
    186187            'depcode,current_level,current_session,current_verdict,'
    187             'entry_sessionfaccode,depcode,certcode,'
     188            'entry_session,faccode,depcode,certcode,'
    188189            'nysc_senate_info,nysc_date_of_graduation,nysc_updated,%s\r\n'
    189             'A111111,234,123,Anna,M.,Tester,f,NG,1981-02-04#,created,ug_ft,'
    190             'CERT1,NA,NA,200,2012,0,,NA,CERT1,,,,,,,,,12.12,,,,,,\r\n' % year_range_str,
     190            'A111111,234,123,Anna,M.,Tester,f,NG,1981-02-04#,created,xyz,abc,ug_ft,'
     191            'CERT1,NA,NA,200,2012,0,2010,NA,NA,CERT1,,,,,,,,,12.12,,,,,,\r\n' % year_range_str,
    191192            result
    192193            )
Note: See TracChangeset for help on using the changeset viewer.