Ignore:
Timestamp:
13 Jan 2020, 13:06:54 (5 years ago)
Author:
Henrik Bettermann
Message:

Add session_levelfilter to StudentStudyLevelExporter.

Adjust tests.

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

Legend:

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

    r15880 r15918  
    441.6.1.dev0 (unreleased)
    55=======================
     6
     7* Add `session_level`filter to `StudentStudyLevelExporter`.
    68
    79* Add LetterPDFCreator utility and use this pdf creator
  • main/waeup.kofa/trunk/docs/source/userdocs/datacenter/export.rst

    r15873 r15918  
    222222
    223223Student Outstanding Courses Exporter
    224 ----------------------
     224------------------------------------
    225225
    226226.. autoclass:: waeup.kofa.students.export.StudentOutstandingCoursesExporter()
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r15664 r15918  
    5050    def setup_container(self, container):
    5151        # set all attributes of a container
    52         container.code = u'dp2015'
     52        container.code = u'dp2017'
    5353        container.title = u'General Studies'
    5454        container.prefix = list(ApplicationTypeSource()(container))[0]
    55         container.year = 2015
     55        container.year = 2017
    5656        container.application_category = list(AppCatSource()(container))[0]
    5757        container.description = u'Some Description\nwith linebreak\n'
    5858        container.description += u'<<de>>man spriht deutsh'
    5959        container.startdate = datetime.datetime(
    60             2015, 1, 1, 12, 0, 0, tzinfo=pytz.utc)
     60            2017, 1, 1, 12, 0, 0, tzinfo=pytz.utc)
    6161        container.enddate = datetime.datetime(
    62             2015, 1, 31, 23, 0, 0, tzinfo=pytz.utc)
     62            2017, 1, 31, 23, 0, 0, tzinfo=pytz.utc)
    6363        return container
    6464
     
    7676            'strict_deadline,title,with_picture,year\r\n'
    7777
    78             'basic,0.0,,dp2015,'
     78            'basic,0.0,,dp2017,'
    7979            '"Some Description\nwith linebreak\n<<de>>man spriht deutsh",'
    80             '2015-01-31 23:00:00+00:00#,0,,app,2015-01-01 12:00:00+00:00#,1,'
    81             'General Studies,1,2015\r\n'
     80            '2017-01-31 23:00:00+00:00#,0,,app,2017-01-01 12:00:00+00:00#,1,'
     81            'General Studies,1,2017\r\n'
    8282            )
    8383        return
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py

    r15609 r15918  
    449449            'zope.mgr - students.browser.DatacenterExportJobContainerJobConfig '
    450450            '- exported: students '
    451             '(None, None, None, None, None, None, , , all, all, all, all), '
     451            '(None, None, None, None, None, None, , , all, all, all, all, all), '
    452452            'job_id=%s'
    453453            % job_id in logcontent)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r15880 r15918  
    39593959               payments_start=None, payments_end=None, ct_level=None,
    39603960               ct_session=None, ct_semester=None, paycat=None,
    3961                paysession=None, exporter=None):
     3961               paysession=None, level_session=None, exporter=None):
    39623962        self._set_session_values()
    39633963        self._set_level_values()
     
    40034003                                          ct_session = ct_session,
    40044004                                          ct_semester = ct_semester,
     4005                                          level_session=level_session,
    40054006                                          )
    40064007        else:
     
    40194020                                          ct_level = ct_level,
    40204021                                          ct_session = ct_session,
    4021                                           ct_semester = ct_semester,)
     4022                                          ct_semester = ct_semester,
     4023                                          level_session=level_session,)
    40224024        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    40234025        self.context.logger.info(
    4024             '%s - exported: %s (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s), job_id=%s'
     4026            '%s - exported: %s (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s), job_id=%s'
    40254027            % (ob_class, exporter, session, level, mode, self.faccode,
    40264028            self.depcode, self.certcode, payments_start, payments_end,
    4027             ct_level, ct_session, paycat, paysession, job_id))
     4029            ct_level, ct_session, paycat, paysession, level_session, job_id))
    40284030        self.flash(_('Export started for students with') +
    40294031                   ' current_session=%s, current_level=%s, study_mode=%s' % (
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/exportconfig.pt

    r15546 r15918  
    9595  </span>
    9696
     97  <span id="level_session" style="display: none;">
     98    <br />
     99    <label for="level_session" i18n:translate="">
     100      Level Session
     101    </label>
     102    <select name="level_session" class="form-control half">
     103      <option tal:repeat="item view/sessions"
     104              tal:attributes="value python:item[1]">
     105        <span tal:replace="python: item[0]">2018/2019</span>
     106      </option>
     107    </select>
     108    <br />
     109  </span>
     110
    97111  <span id="ct_data" style="display: none;">
    98112    <br />
     
    144158          document.getElementById('payment_dates').style.display = 'block';
    145159          document.getElementById('paycat').style.display = 'block';
     160          document.getElementById('paysession').style.display = 'block';
    146161          document.getElementById('ct_data').style.display = 'none';
    147           document.getElementById('paysession').style.display = 'block';
     162          document.getElementById('level_session').style.display = 'none';
    148163
    149164      } else if (document.getElementById('exporter').value == 'coursetickets')  {
     
    152167          document.getElementById('paycat').style.display = 'none';
    153168          document.getElementById('paysession').style.display = 'none';
     169          document.getElementById('level_session').style.display = 'none';
     170
     171      } else if (document.getElementById('exporter').value == 'studentstudylevels')  {
     172          document.getElementById('ct_data').style.display = 'none';
     173          document.getElementById('payment_dates').style.display = 'none';
     174          document.getElementById('paycat').style.display = 'none';
     175          document.getElementById('paysession').style.display = 'none';
     176          document.getElementById('level_session').style.display = 'block';
    154177
    155178      } else {
     
    158181          document.getElementById('paycat').style.display = 'none';
    159182          document.getElementById('paysession').style.display = 'none';
     183          document.getElementById('level_session').style.display = 'none';
    160184      }
    161185  }
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r15873 r15918  
    4646            if x is not None]
    4747
    48 def get_levels(students):
     48def get_levels(students, **kw):
    4949    """Get all studylevels of `students`.
    5050    """
    5151    levels = []
     52    level_session = kw.get('level_session', None)
    5253    for course in get_studycourses(students):
    5354        for level in course.values():
     55            if level_session not in ('all', None) and \
     56                int(level_session) != level.level_session:
     57                continue
    5458            levels.append(level)
    5559    return levels
     
    7377    ct_semester = kw.get('ct_semester', None)
    7478    if code is None:
    75         for level_obj in get_levels(students):
     79        for level_obj in get_levels(students, **kw):
    7680            for ticket in level_obj.values():
    7781                if ct_level not in ('all', None):
     
    9094                tickets.append(ticket)
    9195    else:
    92         for level_obj in get_levels(students):
     96        for level_obj in get_levels(students, **kw):
    9397            for ticket in level_obj.values():
    9498                if ticket.code != code:
     
    116120    level_session = kw.get('session', None)
    117121    level = kw.get('level', None)
    118     for level_obj in get_levels(students):
     122    for level_obj in get_levels(students, **kw):
    119123        for ticket in level_obj.values():
    120124            if ticket.code != code:
     
    253257        except KeyError:
    254258            pass
     259        # Studylevels can be filtered by level_session.
     260        # This parameter is not a key of the catalog and must thus be
     261        # removed from kw.
     262        try:
     263            del kw['level_session']
     264        except KeyError:
     265            pass
    255266        query = StudentsQuery(**kw)
    256267        return query.query()
     
    378389
    379390    def filter_func(self, x, **kw):
    380         return get_levels(x)
     391        return get_levels(x, **kw)
    381392
    382393    def mangle_value(self, value, name, context=None):
     
    705716        paycatyears = []
    706717        if cas:
    707             year_range = range(cas - 2, cas+1)
     718            year_range = range(cas-2, cas+1)
    708719            year_range_tuple = tuple([str(year)[2:] for year in year_range])
    709720            paycatyears = [
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r15709 r15918  
    37603760            'zope.mgr - students.browser.DatacenterExportJobContainerJobConfig '
    37613761            '- exported: bursary (2004, 100, ug_ft, None, None, None, '
    3762             '13/12/2012, 14/12/2012, all, all, all, all), job_id=%s'
     3762            '13/12/2012, 14/12/2012, all, all, all, all, all), job_id=%s'
    37633763            % job_id in logcontent
    37643764            )
     
    38433843            self.browser.headers['content-disposition'])
    38443844        self.assertTrue(
    3845             '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
     3845            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,%s,'
    38463846            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    3847             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     3847            'Tester,created,2004,2004,,fac1,dep1,CERT1'
     3848            %(curr_year-6) in self.browser.contents)
    38483849        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
    38493850        job_id = self.app['datacenter'].running_exports[0][0]
     
    38593860            'zope.mgr - students.browser.FacultiesExportJobContainerJobConfig '
    38603861            '- exported: bursary (2004, 100, ug_ft, None, None, None, '
    3861             '13/12/2012, 14/12/2012, all, all, schoolfee, all), job_id=%s'
     3862            '13/12/2012, 14/12/2012, all, all, schoolfee, all, all), job_id=%s'
    38623863            % job_id in logcontent
    38633864            )
     
    38893890            self.browser.headers['content-disposition'])
    38903891        self.assertTrue(
    3891             '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
     3892            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,%s,'
    38923893            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    3893             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     3894            'Tester,created,2004,2004,,fac1,dep1,CERT1'
     3895            %(curr_year-6) in self.browser.contents)
    38943896
    38953897    def test_faculty_export(self):
     
    39413943            'zope.mgr - students.browser.FacultyExportJobContainerJobConfig '
    39423944            '- exported: students (2004, 100, ug_ft, fac1, None, None, '
    3943             '13/12/2012, 14/12/2012, all, all, all, all), job_id=%s'
     3945            '13/12/2012, 14/12/2012, all, all, all, all, all), job_id=%s'
    39443946            % job_id in logcontent
    39453947            )
     
    40004002            'zope.mgr - students.browser.DepartmentExportJobContainerJobConfig '
    40014003            '- exported: students (2004, 100, ug_ft, None, dep1, None, '
    4002             '13/12/2012, 14/12/2012, all, all, all, all), job_id=%s'
     4004            '13/12/2012, 14/12/2012, all, all, all, all, all), job_id=%s'
    40034005            % job_id in logcontent
    40044006            )
     
    40474049            'zope.mgr - students.browser.CertificateExportJobContainerJobConfig '
    40484050            '- exported: students '
    4049             '(2004, 100, None, None, None, CERT1, , , None, None, None, None), '
     4051            '(2004, 100, None, None, None, CERT1, , , None, None, '
     4052            'None, None, None), '
    40504053            'job_id=%s'
    40514054            % job_id in logcontent
     
    42464249            self.browser.headers['content-disposition'])
    42474250        self.assertTrue(
    4248             '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
     4251            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,%s,'
    42494252            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    4250             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     4253            'Tester,created,2004,2004,,fac1,dep1,CERT1'
     4254            %(curr_year-6) in self.browser.contents)
    42514255        # ... and discarded
    42524256        self.browser.open('http://localhost/app/faculties/exports')
     
    42724276            self.browser.headers['content-disposition'])
    42734277        self.assertTrue(
    4274             '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,2013,'
     4278            '666,12.12,2012-12-13 00:00:00#,schoolfee,[],1,my-id,p-item,100,%s,'
    42754279            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
    4276             'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     4280            'Tester,created,2004,2004,,fac1,dep1,CERT1'
     4281            %(curr_year-6) in self.browser.contents)
    42774282
    42784283    def test_export_accommodation_officers(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r15873 r15918  
    13651365        super(SessionPaymentsOverviewExporterTest, self).setUp()
    13661366        self.setup_for_export()
     1367        paycats = ('schoolfee', 'clearance', 'gown', 'transcript')
     1368        paycatyears = ''
    13671369        grok.getSite()['configuration'].current_academic_session = curr_year - 4
     1370        year_range = range(curr_year-6, curr_year-3)
     1371        year_range_tuple = tuple([str(year)[2:] for year in year_range])
     1372        for cat in paycats:
     1373            for year in year_range_tuple:
     1374                paycatyears += '%s,'%(cat+str(year))
     1375        self.paycatyears = paycatyears.strip(',')
    13681376        return
    13691377
     
    13891397            'student_id,matric_number,display_fullname,state,certcode,'
    13901398            'faccode,depcode,is_postgrad,current_level,current_session,'
    1391             'current_mode,entry_session,reg_number,schoolfee13,'
    1392             'schoolfee14,schoolfee15,clearance13,clearance14,clearance15,'
    1393             'gown13,gown14,gown15,transcript13,transcript14,transcript15\r\n'
     1399            'current_mode,entry_session,reg_number,%s\r\n'
    13941400            'A111111,234,Anna M. Tester,created,CERT1,NA,NA,0,200,'
    13951401            '2012,ug_ft,2010,123,'
    1396             '12.12,,,,,,,,,,,\r\n' in result
     1402            '12.12,,,,,,,,,,,\r\n' %self.paycatyears in result
    13971403            )
    13981404        return
     
    14311437            'student_id,matric_number,display_fullname,state,certcode,faccode,'
    14321438            'depcode,is_postgrad,current_level,current_session,'
    1433             'current_mode,entry_session,reg_number,'
    1434             'schoolfee13,schoolfee14,schoolfee15,'
    1435             'clearance13,clearance14,clearance15,'
    1436             'gown13,gown14,gown15,'
    1437             'transcript13,transcript14,transcript15\r\n'
     1439            'current_mode,entry_session,reg_number,%s\r\n'
    14381440            'A111111,234,Anna M. Tester,created,CERT1,NA,NA,0,200,2012,ug_ft,'
    14391441            '2010,123,'
    14401442            '12.12,14.14,1.01,,,,,,,,,\r\n'
    1441             in result
     1443            %self.paycatyears in result
    14421444            )
    14431445        return
Note: See TracChangeset for help on using the changeset viewer.