Ignore:
Timestamp:
14 Aug 2019, 19:55:53 (5 years ago)
Author:
Henrik Bettermann
Message:

Add FacultiesExportJobContainerSelectStudents view to allow
bursary officers to export student data for a small subset of students
by entering a list of student ids or matric numbers.

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

Legend:

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

    r15502 r15545  
    441.6.1.dev0 (unreleased)
    55=======================
     6
     7* Add `FacultiesExportJobContainerSelectStudents` view to allow
     8  bursary officers to export student data for a  small subset of students
     9  by entering a list of student ids or matric numbers.
    610
    711* Add passport picture switch to applicants containers.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r15544 r15545  
    37293729    doclink = DOCLINK + '/datacenter/export.html#student-data-exporters'
    37303730
    3731     def update(self, CREATE=None, DISCARD=None, job_id=None):
    3732         if CREATE:
     3731    def update(self, CREATE1=None, CREATE2=None, DISCARD=None, job_id=None):
     3732        if CREATE1:
    37333733            self.redirect(self.url('@@exportconfig'))
     3734            return
     3735        if CREATE2:
     3736            self.redirect(self.url('@@exportselected'))
    37343737            return
    37353738        if DISCARD and job_id:
     
    37493752    """
    37503753    grok.baseclass()
    3751     grok.name('exportconfig')
    37523754    grok.require('waeup.showStudents')
    37533755    grok.template('exportconfig')
     
    39123914
    39133915    """
     3916    grok.name('exportconfig')
    39143917    grok.context(IDataCenter)
    39153918    redirect_target = '@@export'
     
    39233926    redirect_target = '@@export'
    39243927    grok.template('exportselected')
    3925     label = _('Configure student data export')
    39263928
    39273929    def update(self, START=None, students=None, exporter=None):
     
    39493951        return
    39503952
    3951 class FacultiesExportJobContainerJobConfig(ExportJobContainerJobConfig):
     3953class FacultiesExportJobContainerJobConfig(
     3954    DatacenterExportJobContainerJobConfig):
    39523955    """Page that configures a students export job in facultiescontainer.
    39533956
    39543957    """
    39553958    grok.context(VirtualFacultiesExportJobContainer)
    3956 
    3957 
    3958 class FacultyExportJobContainerJobConfig(ExportJobContainerJobConfig):
     3959    redirect_target = ''
     3960
     3961class FacultiesExportJobContainerSelectStudents(
     3962    DatacenterExportJobContainerSelectStudents):
     3963    """Page that configures a students export job in facultiescontainer.
     3964
     3965    """
     3966    grok.context(VirtualFacultiesExportJobContainer)
     3967    redirect_target = ''
     3968
     3969class FacultyExportJobContainerJobConfig(DatacenterExportJobContainerJobConfig):
    39593970    """Page that configures a students export job in faculties.
    39603971
    39613972    """
    39623973    grok.context(VirtualFacultyExportJobContainer)
     3974    redirect_target = ''
    39633975
    39643976    @property
     
    39663978        return self.context.__parent__.code
    39673979
    3968 class DepartmentExportJobContainerJobConfig(ExportJobContainerJobConfig):
     3980class DepartmentExportJobContainerJobConfig(
     3981    DatacenterExportJobContainerJobConfig):
    39693982    """Page that configures a students export job in departments.
    39703983
    39713984    """
    39723985    grok.context(VirtualDepartmentExportJobContainer)
     3986    redirect_target = ''
    39733987
    39743988    @property
     
    39763990        return self.context.__parent__.code
    39773991
    3978 class CertificateExportJobContainerJobConfig(ExportJobContainerJobConfig):
     3992class CertificateExportJobContainerJobConfig(
     3993    DatacenterExportJobContainerJobConfig):
    39793994    """Page that configures a students export job for certificates.
    39803995
     
    39823997    grok.context(VirtualCertificateExportJobContainer)
    39833998    grok.template('exportconfig_certificate')
     3999    redirect_target = ''
    39844000
    39854001    @property
     
    39874003        return self.context.__parent__.code
    39884004
    3989 class CourseExportJobContainerJobConfig(ExportJobContainerJobConfig):
     4005class CourseExportJobContainerJobConfig(
     4006    DatacenterExportJobContainerJobConfig):
    39904007    """Page that configures a students export job for courses.
    39914008
     
    39964013    grok.context(VirtualCourseExportJobContainer)
    39974014    grok.template('exportconfig_course')
     4015    redirect_target = ''
    39984016
    39994017    def _set_exporter_values(self):
     
    40054023            exporters.append((util.title, name),)
    40064024        self.exporters = exporters
     4025        return
    40074026
    40084027    def _set_session_values(self):
     
    40184037    def update(self, START=None, session=None, level=None, mode=None,
    40194038               exporter=None):
     4039        if not checkPermission('waeup.exportData', self.context):
     4040            self.flash(_('Not permitted.'), type='danger')
     4041            self.redirect(self.url(self.context))
     4042            return
    40204043        self._set_session_values()
    40214044        self._set_level_values()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/exportjobsindex.pt

    r11254 r15545  
    5555
    5656<form method="POST" i18n:domain="waeup.kofa">
    57   <input class="btn btn-primary" type="submit" name="CREATE"
    58          value="Configure new export"
     57  <input class="btn btn-primary" type="submit" name="CREATE1"
     58         value="Set export parameters"
     59          />
     60  <input tal:condition="python:context.__parent__.__name__ == 'faculties'"
     61         class="btn btn-primary" type="submit" name="CREATE2"
     62         value="Enter student ids or matric numbers"
    5963          />
    6064</form>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r15508 r15545  
    38123812        self.browser.open(facs_path)
    38133813        self.browser.getLink("Export student data").click()
    3814         self.browser.getControl("Configure new export").click()
     3814        self.browser.getControl("Set export parameters").click()
    38153815        self.browser.getControl(name="exporter").value = ['bursary']
    38163816        self.browser.getControl(name="session").value = ['2004']
     
    38613861            '- discarded: job_id=%s' % job_id in logcontent
    38623862            )
     3863        # Officer can also enter student id and gets the same export file
     3864        self.browser.open(facs_path)
     3865        self.browser.getLink("Export student data").click()
     3866        self.browser.getControl("Enter student ids or matric numbers").click()
     3867        self.browser.getControl(name="exporter").value = ['bursary']
     3868        self.browser.getControl(name="students").value = 'K1000000'
     3869        self.browser.getControl("Create CSV file").click()
     3870        # When the job is finished and we reload the page...
     3871        job_id = self.wait_for_export_job_completed()
     3872        # ... the csv file can be downloaded ...
     3873        self.browser.open('http://localhost/app/faculties/exports')
     3874        self.browser.getLink("Download").click()
     3875        self.assertEqual(self.browser.headers['content-type'],
     3876            'text/csv; charset=UTF-8')
     3877        self.assertTrue(
     3878            'filename="WAeUP.Kofa_bursary_%s.csv' % job_id in
     3879            self.browser.headers['content-disposition'])
     3880        self.assertTrue(
     3881            '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
     3882            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
     3883            'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
    38633884
    38643885    def test_faculty_export(self):
     
    38673888        self.browser.open(fac1_path)
    38683889        self.browser.getLink("Export student data").click()
    3869         self.browser.getControl("Configure new export").click()
     3890        self.browser.getControl("Set export parameters").click()
    38703891        self.browser.getControl(name="exporter").value = ['students']
    38713892        self.browser.getControl(name="session").value = ['2004']
     
    38773898        self.browser.getControl(name="payments_end").value = '14/12/2012'
    38783899        self.browser.getControl("Create CSV file").click()
    3879 
    38803900        # When the job is finished and we reload the page...
    38813901        job_id = self.wait_for_export_job_completed()
     
    39223942            '- discarded: job_id=%s' % job_id in logcontent
    39233943            )
     3944        # Officer can set export parameters but cannot enter student id
     3945        # at faculty level
     3946        self.browser.open(fac1_path + '/exports')
     3947        self.assertTrue("Set export parameters"
     3948                         in self.browser.contents)
     3949        self.assertFalse("Enter student ids or matric numbers"
     3950                         in self.browser.contents)
    39243951
    39253952    def test_department_export(self):
     
    39283955        self.browser.open(dep1_path)
    39293956        self.browser.getLink("Export student data").click()
    3930         self.browser.getControl("Configure new export").click()
     3957        self.browser.getControl("Set export parameters").click()
    39313958        self.browser.getControl(name="exporter").value = ['students']
    39323959        self.browser.getControl(name="session").value = ['2004']
     
    39804007        self.browser.open(cert1_path)
    39814008        self.browser.getLink("Export student data").click()
    3982         self.browser.getControl("Configure new export").click()
     4009        self.browser.getControl("Set export parameters").click()
    39834010        self.browser.getControl(name="exporter").value = ['students']
    39844011        self.browser.getControl(name="session").value = ['2004']
     
    40284055        self.browser.open(course1_path)
    40294056        self.browser.getLink("Export student data").click()
    4030         self.browser.getControl("Configure new export").click()
     4057        self.browser.getControl("Set export parameters").click()
    40314058        self.browser.getControl(name="exporter").value = ['students']
    40324059        self.browser.getControl(name="session").value = ['2004']
     
    40814108        self.browser.open(course1_path)
    40824109        self.browser.getLink("Export student data").click()
    4083         self.browser.getControl("Configure new export").click()
     4110        self.browser.getControl("Set export parameters").click()
    40844111        self.assertTrue(
    40854112            'Academic session not set. Please contact the administrator.'
    40864113            in self.browser.contents)
    40874114        self.app['configuration'].current_academic_session = 2004
    4088         self.browser.getControl("Configure new export").click()
     4115        self.browser.getControl("Set export parameters").click()
    40894116        self.browser.getControl(name="exporter").value = ['lecturer']
    40904117        self.browser.getControl(name="session").value = ['2004']
     
    41484175        self.browser.open("http://localhost/app/faculties/fac1/dep1")
    41494176        self.browser.getLink("Export student data").click()
    4150         self.browser.getControl("Configure new export").click()
     4177        self.browser.getControl("Set export parameters").click()
    41514178        # Only the sfpaymentsoverview exporter is available for department officers
    41524179        self.assertFalse('<option value="students">' in self.browser.contents)
     
    41664193
    41674194    def test_export_bursary_officers(self):
     4195        self.add_payment(self.student)
    41684196        # Create bursary officer
    41694197        self.app['users'].addUser('mrbursary', SECRET)
     
    41804208        self.browser.getLink("Academics").click()
    41814209        self.browser.getLink("Export student data").click()
    4182         self.browser.getControl("Configure new export").click()
     4210        self.browser.getControl("Set export parameters").click()
    41834211        # Only the bursary exporter is available for bursary officers
    41844212        # not only at facultiescontainer level ...
     
    41934221        self.browser.open('http://localhost/app/faculties/fac1/dep1')
    41944222        self.browser.getLink("Export student data").click()
    4195         self.browser.getControl("Configure new export").click()
     4223        self.browser.getControl("Set export parameters").click()
    41964224        self.assertFalse('<option value="students">' in self.browser.contents)
    41974225        self.assertTrue('<option value="bursary">' in self.browser.contents)
    4198         # Thew job can be discarded
     4226        # Thew job can be downloaded
    41994227        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
    4200         self.wait_for_export_job_completed()
     4228        job_id = self.wait_for_export_job_completed()
     4229        self.browser.open('http://localhost/app/faculties/exports')
     4230        self.browser.getLink("Download").click()
     4231        self.assertEqual(self.browser.headers['content-type'],
     4232            'text/csv; charset=UTF-8')
     4233        self.assertTrue(
     4234            'filename="WAeUP.Kofa_bursary_%s.csv' % job_id in
     4235            self.browser.headers['content-disposition'])
     4236        self.assertTrue(
     4237            '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
     4238            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
     4239            'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
     4240        # ... and discarded
    42014241        self.browser.open('http://localhost/app/faculties/exports')
    42024242        self.browser.getControl("Discard").click()
    42034243        self.assertEqual(len(self.app['datacenter'].running_exports), 0)
     4244        # At Academics level bursary officers can also enter student ids
     4245        self.browser.getLink("Academics").click()
     4246        self.browser.getLink("Export student data").click()
     4247        self.browser.getControl("Enter student ids or matric numbers").click()
     4248        self.assertFalse('<option value="students">' in self.browser.contents)
     4249        self.browser.getControl(name="exporter").value = ['bursary']
     4250        self.browser.getControl(name="students").value = 'K1000000'
     4251        self.browser.getControl("Create CSV file").click()
     4252        # When the job is finished and we reload the page...
     4253        job_id = self.wait_for_export_job_completed()
     4254        # ... the csv file can be downloaded ...
     4255        self.browser.open('http://localhost/app/faculties/exports')
     4256        self.browser.getLink("Download").click()
     4257        self.assertEqual(self.browser.headers['content-type'],
     4258            'text/csv; charset=UTF-8')
     4259        self.assertTrue(
     4260            'filename="WAeUP.Kofa_bursary_%s.csv' % job_id in
     4261            self.browser.headers['content-disposition'])
     4262        self.assertTrue(
     4263            '666,12.12,2012-12-13 00:00:00#,schoolfee,1,my-id,p-item,100,2013,'
     4264            'paid,2012-12-13 00:00:00#,12.12,r-code,,K1000000,234,123,Anna,,'
     4265            'Tester,created,2004,2004,,fac1,dep1,CERT1' in self.browser.contents)
    42044266
    42054267    def test_export_accommodation_officers(self):
     
    42184280        self.browser.getLink("Academics").click()
    42194281        self.browser.getLink("Export student data").click()
    4220         self.browser.getControl("Configure new export").click()
     4282        self.browser.getControl("Set export parameters").click()
    42214283        # accommodationpayments and beds exporters are available
    42224284        # not only at facultiescontainer level ...
     
    42344296        self.browser.open('http://localhost/app/faculties/fac1/dep1')
    42354297        self.browser.getLink("Export student data").click()
    4236         self.browser.getControl("Configure new export").click()
     4298        self.browser.getControl("Set export parameters").click()
    42374299        self.assertFalse('<option value="students">' in self.browser.contents)
    42384300        self.assertTrue('<option value="accommodationpayments">'
Note: See TracChangeset for help on using the changeset viewer.