diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa60a1b1fc7004324d05274788d79bf77321ef40..b69183fefa265a33dae2b211e318922abc662c73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,6 +64,14 @@ test_python_latest: - coverage run --source web manage.py test -v3 - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*" +test_create_dummy_script: + <<: *test_definition + script: + - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py" + - cd smash + - python manage.py makemigrations web && python manage.py migrate + - python db_scripts/create_dummy_data.py + build_debian: image: debian stage: build diff --git a/smash/db_scripts/create_dummy_data.py b/smash/db_scripts/create_dummy_data.py index dfcb4ffff8a5da756d07e56e1e0eb635afb5b28d..dadf16b1f1093524e1d864ddfab5edfc9ffa274f 100644 --- a/smash/db_scripts/create_dummy_data.py +++ b/smash/db_scripts/create_dummy_data.py @@ -435,6 +435,7 @@ class smashProvider(BaseProvider): virus_iga_1 = choice(["Borderline", "Positive", "Negative"], 1, p=[0.02, 0.03, 0.95])[0] virus_igg_1 = choice(["Borderline", "Positive", "Negative"], 1, p=[0.02, 0.03, 0.95])[0] if virus_test_1_result is None: + virus_test_1_collection_date = '' virus_test_1_updated = fake.date_between(start_date='-30d', end_date='-4d') elif virus_test_1_result == "Inconclusive": virus_test_1_updated = fake.date_between(start_date='-30d', end_date='-4d') @@ -447,14 +448,13 @@ class smashProvider(BaseProvider): virus_test_1_collection_date = fake.date_between(start_date='-30d', end_date='-4d') study_subject, _ = StudySubject.objects.update_or_create(nd_number=nd_number, subject=subject, - virus_test_1_result=virus_test_1_result, - virus_test_1_updated=virus_test_1_updated, - virus_test_1_collection_date=virus_test_1_collection_date, - virus_test_1_iga_status=virus_iga_1, - virus_test_1_igg_status=virus_igg_1, defaults={'default_location': default_location, 'type': type, 'screening_number': screening_number, 'study': study}) - + study_subject.set_custom_field_value('Visit 0 RT-PCR update date', virus_test_1_updated) + study_subject.set_custom_field_value('Virus 0 RT-PCR', virus_test_1_result) + study_subject.set_custom_field_value('Visit 0 RT-PCR collection date', virus_test_1_collection_date) + study_subject.set_custom_field_value('Visit 0 IgA Status', virus_iga_1) + study_subject.set_custom_field_value('Visit 0 IgG Status', virus_igg_1) self.alreadyCreatedStudySubjects.append(study_subject) return study_subject @@ -608,7 +608,7 @@ class smashProvider(BaseProvider): defaults = {'first_name': first_name, 'last_name': last_name, 'email': email, 'unit': unit, 'specialization': specialization, 'phone_number': phone_number, 'user': user} - + worker, _ = Worker.objects.update_or_create(first_name=first_name, last_name=last_name, defaults=defaults)