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

don't forget to modify Language on update

parent a86217ad
No related branches found
No related tags found
1 merge request!301Error logging
Pipeline #36792 passed
......@@ -3,7 +3,7 @@ import logging
import sys
import traceback
from web.models import StudySubject, Subject
from web.models import StudySubject, Subject, Language
from .etl_common import EtlCommon
from .subject_import_reader import SubjectImportReader
from .warning_counter import MsgCounterHandler
......@@ -55,7 +55,9 @@ class Importer(EtlCommon):
for field in Subject._meta.get_fields():
if field.get_internal_type() == "CharField" or \
field.get_internal_type() == "DateField" or \
field.get_internal_type() == "BooleanField":
field.get_internal_type() == "BooleanField" or \
field.get_internal_type() == "TextField" or \
(field.get_internal_type() == "ForeignKey" and field.related_model in (Language,)):
old_value = getattr(db_study_subject.subject, field.name)
new_value = self.get_new_value(old_value, getattr(study_subject.subject, field.name))
self.create_provenance_and_change_data(db_study_subject.subject, field.name, new_value, Subject)
......@@ -64,7 +66,9 @@ class Importer(EtlCommon):
for field in StudySubject._meta.get_fields():
if field.get_internal_type() == "CharField" or \
field.get_internal_type() == "DateField" or \
field.get_internal_type() == "BooleanField":
field.get_internal_type() == "BooleanField" or \
field.get_internal_type() == "TextField" or \
(field.get_internal_type() == "ForeignKey" and field.related_model in (Language,)):
old_value = getattr(db_study_subject, field.name)
new_value = self.get_new_value(old_value, getattr(study_subject, field.name))
self.create_provenance_and_change_data(db_study_subject, field.name, new_value, StudySubject)
......
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