Changeset 15545 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 14 Aug 2019, 19:55:53 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15544 r15545 3729 3729 doclink = DOCLINK + '/datacenter/export.html#student-data-exporters' 3730 3730 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: 3733 3733 self.redirect(self.url('@@exportconfig')) 3734 return 3735 if CREATE2: 3736 self.redirect(self.url('@@exportselected')) 3734 3737 return 3735 3738 if DISCARD and job_id: … … 3749 3752 """ 3750 3753 grok.baseclass() 3751 grok.name('exportconfig')3752 3754 grok.require('waeup.showStudents') 3753 3755 grok.template('exportconfig') … … 3912 3914 3913 3915 """ 3916 grok.name('exportconfig') 3914 3917 grok.context(IDataCenter) 3915 3918 redirect_target = '@@export' … … 3923 3926 redirect_target = '@@export' 3924 3927 grok.template('exportselected') 3925 label = _('Configure student data export')3926 3928 3927 3929 def update(self, START=None, students=None, exporter=None): … … 3949 3951 return 3950 3952 3951 class FacultiesExportJobContainerJobConfig(ExportJobContainerJobConfig): 3953 class FacultiesExportJobContainerJobConfig( 3954 DatacenterExportJobContainerJobConfig): 3952 3955 """Page that configures a students export job in facultiescontainer. 3953 3956 3954 3957 """ 3955 3958 grok.context(VirtualFacultiesExportJobContainer) 3956 3957 3958 class FacultyExportJobContainerJobConfig(ExportJobContainerJobConfig): 3959 redirect_target = '' 3960 3961 class FacultiesExportJobContainerSelectStudents( 3962 DatacenterExportJobContainerSelectStudents): 3963 """Page that configures a students export job in facultiescontainer. 3964 3965 """ 3966 grok.context(VirtualFacultiesExportJobContainer) 3967 redirect_target = '' 3968 3969 class FacultyExportJobContainerJobConfig(DatacenterExportJobContainerJobConfig): 3959 3970 """Page that configures a students export job in faculties. 3960 3971 3961 3972 """ 3962 3973 grok.context(VirtualFacultyExportJobContainer) 3974 redirect_target = '' 3963 3975 3964 3976 @property … … 3966 3978 return self.context.__parent__.code 3967 3979 3968 class DepartmentExportJobContainerJobConfig(ExportJobContainerJobConfig): 3980 class DepartmentExportJobContainerJobConfig( 3981 DatacenterExportJobContainerJobConfig): 3969 3982 """Page that configures a students export job in departments. 3970 3983 3971 3984 """ 3972 3985 grok.context(VirtualDepartmentExportJobContainer) 3986 redirect_target = '' 3973 3987 3974 3988 @property … … 3976 3990 return self.context.__parent__.code 3977 3991 3978 class CertificateExportJobContainerJobConfig(ExportJobContainerJobConfig): 3992 class CertificateExportJobContainerJobConfig( 3993 DatacenterExportJobContainerJobConfig): 3979 3994 """Page that configures a students export job for certificates. 3980 3995 … … 3982 3997 grok.context(VirtualCertificateExportJobContainer) 3983 3998 grok.template('exportconfig_certificate') 3999 redirect_target = '' 3984 4000 3985 4001 @property … … 3987 4003 return self.context.__parent__.code 3988 4004 3989 class CourseExportJobContainerJobConfig(ExportJobContainerJobConfig): 4005 class CourseExportJobContainerJobConfig( 4006 DatacenterExportJobContainerJobConfig): 3990 4007 """Page that configures a students export job for courses. 3991 4008 … … 3996 4013 grok.context(VirtualCourseExportJobContainer) 3997 4014 grok.template('exportconfig_course') 4015 redirect_target = '' 3998 4016 3999 4017 def _set_exporter_values(self): … … 4005 4023 exporters.append((util.title, name),) 4006 4024 self.exporters = exporters 4025 return 4007 4026 4008 4027 def _set_session_values(self): … … 4018 4037 def update(self, START=None, session=None, level=None, mode=None, 4019 4038 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 4020 4043 self._set_session_values() 4021 4044 self._set_level_values() -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/exportjobsindex.pt
r11254 r15545 55 55 56 56 <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" 59 63 /> 60 64 </form> -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15508 r15545 3812 3812 self.browser.open(facs_path) 3813 3813 self.browser.getLink("Export student data").click() 3814 self.browser.getControl(" Configure new export").click()3814 self.browser.getControl("Set export parameters").click() 3815 3815 self.browser.getControl(name="exporter").value = ['bursary'] 3816 3816 self.browser.getControl(name="session").value = ['2004'] … … 3861 3861 '- discarded: job_id=%s' % job_id in logcontent 3862 3862 ) 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) 3863 3884 3864 3885 def test_faculty_export(self): … … 3867 3888 self.browser.open(fac1_path) 3868 3889 self.browser.getLink("Export student data").click() 3869 self.browser.getControl(" Configure new export").click()3890 self.browser.getControl("Set export parameters").click() 3870 3891 self.browser.getControl(name="exporter").value = ['students'] 3871 3892 self.browser.getControl(name="session").value = ['2004'] … … 3877 3898 self.browser.getControl(name="payments_end").value = '14/12/2012' 3878 3899 self.browser.getControl("Create CSV file").click() 3879 3880 3900 # When the job is finished and we reload the page... 3881 3901 job_id = self.wait_for_export_job_completed() … … 3922 3942 '- discarded: job_id=%s' % job_id in logcontent 3923 3943 ) 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) 3924 3951 3925 3952 def test_department_export(self): … … 3928 3955 self.browser.open(dep1_path) 3929 3956 self.browser.getLink("Export student data").click() 3930 self.browser.getControl(" Configure new export").click()3957 self.browser.getControl("Set export parameters").click() 3931 3958 self.browser.getControl(name="exporter").value = ['students'] 3932 3959 self.browser.getControl(name="session").value = ['2004'] … … 3980 4007 self.browser.open(cert1_path) 3981 4008 self.browser.getLink("Export student data").click() 3982 self.browser.getControl(" Configure new export").click()4009 self.browser.getControl("Set export parameters").click() 3983 4010 self.browser.getControl(name="exporter").value = ['students'] 3984 4011 self.browser.getControl(name="session").value = ['2004'] … … 4028 4055 self.browser.open(course1_path) 4029 4056 self.browser.getLink("Export student data").click() 4030 self.browser.getControl(" Configure new export").click()4057 self.browser.getControl("Set export parameters").click() 4031 4058 self.browser.getControl(name="exporter").value = ['students'] 4032 4059 self.browser.getControl(name="session").value = ['2004'] … … 4081 4108 self.browser.open(course1_path) 4082 4109 self.browser.getLink("Export student data").click() 4083 self.browser.getControl(" Configure new export").click()4110 self.browser.getControl("Set export parameters").click() 4084 4111 self.assertTrue( 4085 4112 'Academic session not set. Please contact the administrator.' 4086 4113 in self.browser.contents) 4087 4114 self.app['configuration'].current_academic_session = 2004 4088 self.browser.getControl(" Configure new export").click()4115 self.browser.getControl("Set export parameters").click() 4089 4116 self.browser.getControl(name="exporter").value = ['lecturer'] 4090 4117 self.browser.getControl(name="session").value = ['2004'] … … 4148 4175 self.browser.open("http://localhost/app/faculties/fac1/dep1") 4149 4176 self.browser.getLink("Export student data").click() 4150 self.browser.getControl(" Configure new export").click()4177 self.browser.getControl("Set export parameters").click() 4151 4178 # Only the sfpaymentsoverview exporter is available for department officers 4152 4179 self.assertFalse('<option value="students">' in self.browser.contents) … … 4166 4193 4167 4194 def test_export_bursary_officers(self): 4195 self.add_payment(self.student) 4168 4196 # Create bursary officer 4169 4197 self.app['users'].addUser('mrbursary', SECRET) … … 4180 4208 self.browser.getLink("Academics").click() 4181 4209 self.browser.getLink("Export student data").click() 4182 self.browser.getControl(" Configure new export").click()4210 self.browser.getControl("Set export parameters").click() 4183 4211 # Only the bursary exporter is available for bursary officers 4184 4212 # not only at facultiescontainer level ... … … 4193 4221 self.browser.open('http://localhost/app/faculties/fac1/dep1') 4194 4222 self.browser.getLink("Export student data").click() 4195 self.browser.getControl(" Configure new export").click()4223 self.browser.getControl("Set export parameters").click() 4196 4224 self.assertFalse('<option value="students">' in self.browser.contents) 4197 4225 self.assertTrue('<option value="bursary">' in self.browser.contents) 4198 # Thew job can be d iscarded4226 # Thew job can be downloaded 4199 4227 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 4201 4241 self.browser.open('http://localhost/app/faculties/exports') 4202 4242 self.browser.getControl("Discard").click() 4203 4243 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) 4204 4266 4205 4267 def test_export_accommodation_officers(self): … … 4218 4280 self.browser.getLink("Academics").click() 4219 4281 self.browser.getLink("Export student data").click() 4220 self.browser.getControl(" Configure new export").click()4282 self.browser.getControl("Set export parameters").click() 4221 4283 # accommodationpayments and beds exporters are available 4222 4284 # not only at facultiescontainer level ... … … 4234 4296 self.browser.open('http://localhost/app/faculties/fac1/dep1') 4235 4297 self.browser.getLink("Export student data").click() 4236 self.browser.getControl(" Configure new export").click()4298 self.browser.getControl("Set export parameters").click() 4237 4299 self.assertFalse('<option value="students">' in self.browser.contents) 4238 4300 self.assertTrue('<option value="accommodationpayments">'
Note: See TracChangeset for help on using the changeset viewer.