Skip to content
Snippets Groups Projects
Commit 2fb5f99a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

self.study is not required anymore

parent 66d890f1
No related branches found
No related tags found
1 merge request!275Resolve "update automatic visit/subject importer"
...@@ -14,7 +14,6 @@ logger = logging.getLogger(__name__) ...@@ -14,7 +14,6 @@ logger = logging.getLogger(__name__)
class CsvSubjectImportReader(SubjectImportReader): class CsvSubjectImportReader(SubjectImportReader):
def __init__(self, import_data: SubjectImportData): def __init__(self, import_data: SubjectImportData):
super().__init__(import_data) super().__init__(import_data)
self.study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0]
def load_data(self, filename): def load_data(self, filename):
study_subjects = [] study_subjects = []
...@@ -25,7 +24,7 @@ class CsvSubjectImportReader(SubjectImportReader): ...@@ -25,7 +24,7 @@ class CsvSubjectImportReader(SubjectImportReader):
subject = Subject() subject = Subject()
study_subject = StudySubject() study_subject = StudySubject()
study_subject.subject = subject study_subject.subject = subject
study_subject.study = self.study study_subject.study = self.import_data.study
for header, value in zip(headers, row): for header, value in zip(headers, row):
self.add_data(study_subject, header, value) self.add_data(study_subject, header, value)
if study_subject.nd_number is None or study_subject.nd_number == "": if study_subject.nd_number is None or study_subject.nd_number == "":
......
...@@ -15,7 +15,6 @@ logger = logging.getLogger(__name__) ...@@ -15,7 +15,6 @@ logger = logging.getLogger(__name__)
class TnsCsvSubjectImportReader(SubjectImportReader): class TnsCsvSubjectImportReader(SubjectImportReader):
def __init__(self, import_data: SubjectImportData): def __init__(self, import_data: SubjectImportData):
super().__init__(import_data) super().__init__(import_data)
self.study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0]
def load_data(self, filename): def load_data(self, filename):
study_subjects = [] study_subjects = []
...@@ -26,7 +25,7 @@ class TnsCsvSubjectImportReader(SubjectImportReader): ...@@ -26,7 +25,7 @@ class TnsCsvSubjectImportReader(SubjectImportReader):
subject = Subject() subject = Subject()
study_subject = StudySubject() study_subject = StudySubject()
study_subject.subject = subject study_subject.subject = subject
study_subject.study = self.study study_subject.study = self.import_data.study
for header, value in zip(headers, row): for header, value in zip(headers, row):
self.add_data(study_subject, header, value) self.add_data(study_subject, header, value)
if study_subject.nd_number is None or study_subject.nd_number == "": if study_subject.nd_number is None or study_subject.nd_number == "":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment