Ejemplo n.º 1
0
 def run(self, ptype=None):
     """Create/Update student records from csv files"""
     # We need to clear out ProtoStudent and ProtoBarcode
     self._delete_proto()
     convert(self.metadata)
     sis_import.do_barcodes(self.barcodecsv)
     sis_import.do_students(self.studentcsv)
     sis_import.normalize_students()
     sis_import.write_marc(self.outfile, ptype=ptype)
     return 0
Ejemplo n.º 2
0
 def run(self, ptype=None):
     """Create/Update student records from csv files"""
     # We need to clear out ProtoStudent and ProtoBarcode
     self._delete_proto()
     convert(self.metadata)
     sis_import.do_barcodes(self.barcodecsv)
     sis_import.do_students(self.studentcsv)
     sis_import.normalize_students()
     sis_import.write_marc(self.outfile, ptype=ptype)
     return 0
Ejemplo n.º 3
0
 def test_create_student_recs_uow(self):
     """Test generating student records from csv files (uow patron type only)"""
     convert(self.metadata)
     sis_import.do_barcodes(self.barcodecsv)
     assert len(ProtoBarcode.objects.all())
     uowcsvf = os.path.join(student_dir,'uow.csv')
     sis_import.do_students([uowcsvf])
     assert len(ProtoStudent.objects.all())
     sis_import.normalize_students()
     # compare ptype from csv to ptype in ProtoStudent
     ptype = sis_import.get_ptype_for_file('uow.csv')
     uowcsv = csvreader(open(uowcsvf))
     for row in uowcsv:
         if not student_id_pattern.match(row[0]):
             continue
         ps = ProtoStudent.objects.filter(student_id=row[0])[0]
         assert ps.ptype == ptype
     # check that records from ProtoStudent have the same ptype as
     # the corresponding record in Student
     uow = ProtoStudent.objects.filter(ptype=ptype)
     for r in uow:
         s = Student.objects.get(student_id=r.student_id)
         assert s.ptype == ptype 
     sis_import.write_marc('/tmp/testdata.lfts')