Changeset 11483


Ignore:
Timestamp:
12 Mar 2014, 18:38:35 (11 years ago)
Author:
Henrik Bettermann
Message:

Do also export student and course ticket data of students on probation.

Location:
main/waeup.kofa/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r11482 r11483  
    441.0.1dev (unreleased)
    55=====================
     6
     7* Do also export student and course ticket data of students on probation.
    68
    79* 'Create student' option removed from 'Application Transition'
  • main/waeup.kofa/trunk/src/waeup/kofa/catalog.py

    r9847 r11483  
    124124            if idx_name == 'catalog':
    125125                continue
    126             if value is not None and ('session' in idx_name
    127                 or 'level' in idx_name):
    128                 value = int(value)
     126            if value is not None:
     127                if 'session' in idx_name or 'level' in idx_name:
     128                    value = int(value)
     129                if idx_name in ('level', 'current_level'):
     130                    value = int(value)
     131                    if value not in (10, 999):
     132                        value = (value, value + 90)
    129133            if not isinstance(value, tuple):
    130134                value = (value, value)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r10650 r11483  
    7979                if ticket.code != code:
    8080                    continue
    81                 if level is not None and int(level) != level_obj.level:
    82                     continue
     81                if level is not None:
     82                    level = int(level)
     83                    if level_obj.level in (10, 999, None)  \
     84                        and int(level) != level_obj.level:
     85                        continue
     86                    if level_obj.level not in range(level, level+100, 10):
     87                        continue
    8388                if level_session is not None and \
    8489                    int(level_session) != level_obj.level_session:
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r10874 r11483  
    207207            current_session=2012, current_level=None)
    208208        result2 = open(self.outfile, 'rb').read()
    209         # current_level can be both a string ...
     209        # current_level and current_session can be both a string ...
    210210        exporter.export_filtered(
    211211            self.app, self.outfile,
    212             current_session=None, current_level=u'200')
     212            current_session='2012', current_level=u'200')
    213213        result3 = open(self.outfile, 'rb').read()
    214214        exporter.export_filtered(
     
    221221            current_session=None, current_level=100)
    222222        result5 = open(self.outfile, 'rb').read()
     223        # Also students at probating levels are being exported ...
     224        self.student['studycourse'].current_level = 210
     225        notify(grok.ObjectModifiedEvent(self.student))
     226        exporter.export_filtered(
     227            self.app, self.outfile,
     228            current_session=None, current_level=200)
     229        result6 = open(self.outfile, 'rb').read()
     230        # ... but not in the wrong level range.
     231        self.student['studycourse'].current_level = 310
     232        notify(grok.ObjectModifiedEvent(self.student))
     233        exporter.export_filtered(
     234            self.app, self.outfile,
     235            current_session=None, current_level=200)
     236        result7 = open(self.outfile, 'rb').read()
    223237        self.assertTrue(self.std_csv_entry in result1)
    224238        self.assertTrue(self.std_csv_entry in result2)
    225239        self.assertTrue(self.std_csv_entry in result3)
    226         self.assertTrue(self.std_csv_entry not in result4)
    227         self.assertTrue(self.std_csv_entry not in result5)
     240        self.assertFalse(self.std_csv_entry in result4)
     241        self.assertFalse(self.std_csv_entry in result5)
     242        self.assertTrue(self.std_csv_entry in result6)
     243        self.assertFalse(self.std_csv_entry in result7)
    228244        return
    229245
     
    467483        exporter = StudentStudyLevelExporter()
    468484        exporter.export_filtered(
    469             self.student, self.outfile, current_level=200)
     485            self.student, self.outfile)
    470486        result = open(self.outfile, 'rb').read()
    471487        self.assertEqual(
     
    569585        exporter = CourseTicketExporter()
    570586        exporter.export_filtered(
    571             self.student, self.outfile, current_level=200)
     587            self.student, self.outfile)
    572588        result = open(self.outfile, 'rb').read()
    573589        self.assertEqual(
     
    596612            'automatic,carry_over,code,credits,dcode,fcode,level,level_session,'
    597613            'mandatory,passmark,score,semester,title,student_id,certcode\r\n'
     614            )
     615        # Also tickets in probating levels are exported. Therefore
     616        # we change the level attribute to fake a 110 level.
     617        self.student['studycourse']['100'].level = 110
     618        notify(grok.ObjectModifiedEvent(self.student['studycourse']['100']['CRS1']))
     619        exporter.export_filtered(
     620            self.student, self.outfile, catalog='coursetickets', code='CRS1', level='100')
     621        result = open(self.outfile, 'rb').read()
     622        self.assertEqual(
     623            result,
     624            'automatic,carry_over,code,credits,dcode,fcode,level,level_session,'
     625            'mandatory,passmark,score,semester,title,student_id,certcode\r\n'
     626            '1,1,CRS1,100,DEP1,FAC1,110,2012,0,100,,2,Course 1,A111111,CERT1\r\n'
    598627            )
    599628        return
Note: See TracChangeset for help on using the changeset viewer.