Ignore:
Timestamp:
13 May 2024, 06:26:57 (8 months ago)
Author:
Henrik Bettermann
Message:

After import with entry_mode 'transfer' we must ensure that after export and reimport the student is not transferred again.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/student.py

    r16713 r17769  
    306306        try:
    307307            newcourse.certificate = certificate
    308             newcourse.entry_mode = 'transfer'
     308            # After import with entry_mode 'transfer'
     309            # we must ensure that after export and reimport
     310            # the student is not transferred again.
     311            newcourse.entry_mode = 'transferred'
    309312            newcourse.current_session = current_session
    310313            newcourse.current_level = current_level
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r17640 r17769  
    569569            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
    570570            )
    571         error = self.student.transfer(self.certificate2, current_session=2013)
     571        exporter = SecondStudentStudyCourseExporter()
     572        exporter.export_all(self.app, self.outfile)
     573        result = open(self.outfile, 'rb').read()
     574        self.assertEqual(
     575            result,
     576            'certificate,current_level,current_session,current_verdict,'
     577            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
     578            )
     579
     580        # First Transfer
     581        error = self.student.transfer(self.certificate2,
     582                                      current_session=2013)
    572583        self.assertTrue(error == None)
    573         exporter.export_all(self.app, self.outfile)
    574         result = open(self.outfile, 'rb').read()
     584        exporter = FirstStudentStudyCourseExporter()
     585        exporter.export_all(self.app, self.outfile)
     586        result = open(self.outfile, 'rb').read()
     587        # This is the original study course
    575588        self.assertEqual(
    576589            result,
     
    578591            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
    579592            'CERT1,200,2012,0,ug_ft,2010,0,A111111,1\r\n')
     593        exporter = SecondStudentStudyCourseExporter()
     594        exporter.export_all(self.app, self.outfile)
     595        result = open(self.outfile, 'rb').read()
     596        self.assertEqual(
     597            result,
     598            'certificate,current_level,current_session,current_verdict,'
     599            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
     600            )
     601
     602        # Second transfer
    580603        error = self.student.transfer(self.certificate,
    581604                                      current_session=2014,
    582605                                      current_level=300)
    583606        self.assertTrue(error == None)
    584         exporter = SecondStudentStudyCourseExporter()
    585         exporter.export_all(self.app, self.outfile)
    586         result = open(self.outfile, 'rb').read()
     607        exporter = FirstStudentStudyCourseExporter()
     608        exporter.export_all(self.app, self.outfile)
     609        result = open(self.outfile, 'rb').read()
     610        # This is the original study course
    587611        self.assertEqual(
    588612            result,
    589613            'certificate,current_level,current_session,current_verdict,'
    590614            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
    591             'CERT2,,2013,,transfer,2010,,A111111,2\r\n')
    592         exporter = StudentStudyCourseExporter()
     615            'CERT1,200,2012,0,ug_ft,2010,0,A111111,1\r\n')
     616        # This is the second study course
     617        exporter = SecondStudentStudyCourseExporter()
    593618        exporter.export_all(self.app, self.outfile)
    594619        result = open(self.outfile, 'rb').read()
     
    597622            'certificate,current_level,current_session,current_verdict,'
    598623            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
    599             'CERT1,300,2014,,transfer,2010,,A111111,0\r\n')
     624            'CERT2,,2013,,transferred,2010,,A111111,2\r\n')
     625        # This is the third study course
     626        exporter = StudentStudyCourseExporter()
     627        exporter.export_all(self.app, self.outfile)
     628        result = open(self.outfile, 'rb').read()
     629        self.assertEqual(
     630            result,
     631            'certificate,current_level,current_session,current_verdict,'
     632            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
     633            'CERT1,300,2014,,transferred,2010,,A111111,0\r\n')
    600634        return
    601635
Note: See TracChangeset for help on using the changeset viewer.