Changeset 17396 for main/waeup.uniben/trunk/src/waeup/uniben
- Timestamp:
- 27 Apr 2023, 13:52:09 (19 months ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/export.py
r17395 r17396 167 167 MedicalHistoryExporter, self).mangle_value( 168 168 value, name, context=context) 169 170 171 class NYSCExporter(SchoolFeePaymentsOverviewExporter): 172 """ 173 """ 174 grok.name('nysc') 175 curr_year = datetime.now().year 176 year_range = range(curr_year - 11, curr_year + 1) 177 year_range_tuple = tuple([str(year) for year in year_range]) 178 fields = ('student_id', 179 'matric_number', 180 'reg_number', 181 'firstname', 182 'middlename', 183 'lastname', 184 'sex', 185 #'email', 186 #'phone', 187 'nationality', 188 'date_of_birth', 189 'state', 190 'current_mode', 191 'certcode', 192 'faccode', 193 'depcode', 194 'current_level', 195 'current_session', 196 'current_verdict', 197 'entry_session' 198 'faccode', 199 'depcode', 200 'certcode', 201 ) + year_range_tuple 202 title = u'NYSC Indication' 203 204 def filter_func(self, x, **kw): 205 students = list() 206 for student in x: 207 if student.nysc == True: 208 students.append(student) 209 return students -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py
r17395 r17396 9 9 from waeup.uniben.students.export import ( 10 10 CustomStudentExporter, CustomStudentPaymentExporter, 11 MedicalHistoryExporter )11 MedicalHistoryExporter, NYSCExporter) 12 12 from waeup.uniben.testing import FunctionalLayer 13 13 … … 152 152 ) 153 153 return 154 155 curr_year = datetime.datetime.now().year 156 year_range = range(curr_year - 11, curr_year + 1) 157 year_range_str = ','.join([str(i) for i in year_range]) 158 159 class NYSCExporterTest(StudentImportExportSetup): 160 161 layer = FunctionalLayer 162 163 def setUp(self): 164 super(NYSCExporterTest, self).setUp() 165 self.setup_for_export() 166 return 167 168 def test_ifaces(self): 169 # make sure we fullfill interface contracts 170 obj = NYSCExporter() 171 verifyObject(ICSVExporter, obj) 172 verifyClass(ICSVExporter, NYSCExporter) 173 return 174 175 def test_export_all(self): 176 # we can really export students 177 # set values we can expect in export file 178 self.setup_student(self.student) 179 self.student.nysc = True 180 exporter = NYSCExporter() 181 exporter.export_all(self.app, self.outfile) 182 result = open(self.outfile, 'rb').read() 183 self.assertMatches( 184 'student_id,matric_number,reg_number,firstname,middlename,lastname,' 185 'sex,nationality,date_of_birth,state,current_mode,certcode,faccode,' 186 'depcode,current_level,current_session,current_verdict,' 187 'entry_sessionfaccode,depcode,certcode,%s\r\n' 188 'A111111,234,123,Anna,M.,Tester,f,NG,1981-02-04#,created,ug_ft,' 189 'CERT1,NA,NA,200,2012,0,,NA,CERT1,,,,,,12.12,,,,,,\r\n' % year_range_str, 190 result 191 ) 192 return -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r17361 r17396 717 717 'trimmedpayments', 718 718 'medicalhistory', 719 'nysc', 719 720 )
Note: See TracChangeset for help on using the changeset viewer.