Ignore:
Timestamp:
31 May 2012, 20:34:44 (13 years ago)
Author:
Henrik Bettermann
Message:

Update according to r8577 - r8582.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/batching.py

    r8460 r8584  
    2121from waeup.kofa.utils.batching import BatchProcessor
    2222from waeup.kofa.applicants.batching import ApplicantProcessor
    23 from waeup.fceokene.applicants.interfaces import ICustomApplicant
     23from waeup.fceokene.applicants.interfaces import (
     24    ICustomApplicant, ICustomApplicantUpdateByRegNo)
    2425
    2526class CustomApplicantProcessor(ApplicantProcessor):
     
    3637    """
    3738    iface = ICustomApplicant
     39    iface_byregnumber = ICustomApplicantUpdateByRegNo
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py

    r8566 r8584  
    3838UG_OMIT_MANAGE_FIELDS = ()
    3939UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
    40     'student_id', 'screening_score', 'screening_venue', 'notice')
     40    'student_id', 'screening_score', 'screening_venue', 'notice',
     41    'screening_date')
    4142PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + (
    4243    'firstname', 'middlename', 'lastname', 'sex',
     
    4849PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + (
    4950    'locked', 'course_admitted',
    50     'student_id', 'screening_score', 'screening_venue', 'notice')
     51    'student_id', 'screening_score', 'screening_venue', 'notice',
     52    'screening_date')
    5153
    5254class IUGApplicant(IApplicantBaseData):
     
    9698    screening_venue = schema.TextLine(
    9799        title = _(u'Screening Venue'),
     100        required = False,
     101        )
     102    screening_date = schema.TextLine(
     103        title = _(u'Screening Date'),
    98104        required = False,
    99105        )
     
    271277        readonly = False,
    272278        )
     279    screening_date = schema.TextLine(
     280        title = _(u'Screening Date'),
     281        required = False,
     282        )
    273283    screening_score = schema.Int(
    274284        title = _(u'Screening Score'),
     
    361371IPUTMEApplicantEdit[
    362372    'email'].order =  IUGApplicant['email'].order
     373
     374class ICustomApplicantUpdateByRegNo(ICustomApplicant):
     375    """Representation of an applicant.
     376
     377    Skip regular reg_number validation if reg_number is used for finding
     378    the applicant object.
     379    """
     380    reg_number = schema.TextLine(
     381        title = u'Registration Number',
     382        required = False,
     383        )
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests.py

    r8537 r8584  
    3636from waeup.fceokene.testing import FunctionalLayer
    3737from waeup.fceokene.applicants.export import CustomApplicantsExporter
     38from waeup.fceokene.applicants.batching import CustomApplicantProcessor
    3839
    3940
     
    235236        applicant.screening_score = 98
    236237        applicant.screening_venue = u'Exam Room'
     238        applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'
    237239        applicant.password = 'any password'
    238240        return applicant
    239241
    240     def test_export_all(self):
     242    def test_export_reimport_all(self):
    241243        # we can export all applicants in a portal
    242244        # set values we can expect in export file
     
    257259            'nationality,notice,nysc_lga,'
    258260            'nysc_year,password,perm_address,phone,pp_school,presently_inst,'
    259             'reg_number,screening_score,screening_venue,sex,state,student_id,'
     261            'reg_number,screening_date,screening_score,screening_venue,sex,'
     262            'state,student_id,'
    260263            'container_code'
    261264            in result)
     
    263266            'Application initialized by system\'],,,,,,,,,Tester,,0,M.,,'
    264267            '"Some notice\nin lines.",,,any password,,+234-123-12345,,,'
    265             '123456,98,Exam Room,f,initialized,,dp2011' in result)
    266         return
     268            '123456,"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,'
     269            'initialized,,dp2011' in result)
     270        # We can import the same file with if we ignore some columns.
     271        # Since the applicants_catalog hasn't been notified, the same
     272        # record with same reg_number can be imported twice.
     273        processor = CustomApplicantProcessor()
     274        result = processor.doImport(
     275            self.outfile,
     276            ['ignore1','application_date','ignore2','course1','course2',''
     277            'course_admitted','date_of_birth','ignore3','email','emp2_end',''
     278            'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',''
     279            'emp_reason','emp_start','employer','employer2','firstname','ignore4',''
     280            'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',''
     281            'jamb_score','jamb_subjects','lastname','lga','locked','middlename',''
     282            'nationality','notice','nysc_lga',''
     283            'nysc_year','password','perm_address','phone','pp_school','presently_inst',''
     284            'reg_number','screening_date','screening_score','screening_venue','sex',''
     285            'state','student_id','container_code'],
     286            mode='create')
     287        num_succ, num_fail, finished_path, failed_path = result
     288        self.assertEqual(num_succ,1)
     289        self.assertEqual(num_fail,0)
     290        return
Note: See TracChangeset for help on using the changeset viewer.