From 2fb5f99ada267191908fc1972cbd8410fc342e85 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 18 Nov 2020 12:34:36 +0100
Subject: [PATCH] self.study is not required anymore

---
 smash/web/importer/csv_subject_import_reader.py     | 3 +--
 smash/web/importer/csv_tns_subject_import_reader.py | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/smash/web/importer/csv_subject_import_reader.py b/smash/web/importer/csv_subject_import_reader.py
index 77c71ab6..c820f4c1 100644
--- a/smash/web/importer/csv_subject_import_reader.py
+++ b/smash/web/importer/csv_subject_import_reader.py
@@ -14,7 +14,6 @@ logger = logging.getLogger(__name__)
 class CsvSubjectImportReader(SubjectImportReader):
     def __init__(self, import_data: SubjectImportData):
         super().__init__(import_data)
-        self.study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0]
 
     def load_data(self, filename):
         study_subjects = []
@@ -25,7 +24,7 @@ class CsvSubjectImportReader(SubjectImportReader):
                 subject = Subject()
                 study_subject = StudySubject()
                 study_subject.subject = subject
-                study_subject.study = self.study
+                study_subject.study = self.import_data.study
                 for header, value in zip(headers, row):
                     self.add_data(study_subject, header, value)
                 if study_subject.nd_number is None or study_subject.nd_number == "":
diff --git a/smash/web/importer/csv_tns_subject_import_reader.py b/smash/web/importer/csv_tns_subject_import_reader.py
index 38c539a9..2c3619f0 100644
--- a/smash/web/importer/csv_tns_subject_import_reader.py
+++ b/smash/web/importer/csv_tns_subject_import_reader.py
@@ -15,7 +15,6 @@ logger = logging.getLogger(__name__)
 class TnsCsvSubjectImportReader(SubjectImportReader):
     def __init__(self, import_data: SubjectImportData):
         super().__init__(import_data)
-        self.study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0]
 
     def load_data(self, filename):
         study_subjects = []
@@ -26,7 +25,7 @@ class TnsCsvSubjectImportReader(SubjectImportReader):
                 subject = Subject()
                 study_subject = StudySubject()
                 study_subject.subject = subject
-                study_subject.study = self.study
+                study_subject.study = self.import_data.study
                 for header, value in zip(headers, row):
                     self.add_data(study_subject, header, value)
                 if study_subject.nd_number is None or study_subject.nd_number == "":
-- 
GitLab