diff --git a/crc/api/study.py b/crc/api/study.py index 9d4a070f..fa6b1e80 100644 --- a/crc/api/study.py +++ b/crc/api/study.py @@ -164,11 +164,13 @@ def user_studies(): cats = spec_service.get_categories() StudyService.synch_with_protocol_builder_if_enabled(user, specs) studies = StudyService().get_studies_for_user(user, categories=cats) - if len(studies) == 0: - studies = StudyService().get_studies_for_user(user, categories=cats, include_invalid=True) - if len(studies) > 0: - message = f"All studies associated with User: {user.uid} failed study validation" - raise ApiError(code="study_integrity_error", message=message) + + # Disable this check - we don't want to raise this error. + # if len(studies) == 0: + # studies = StudyService().get_studies_for_user(user, categories=cats, include_invalid=True) + # if len(studies) > 0: + # message = f"All studies associated with User: {user.uid} failed study validation" + # raise ApiError(code="study_integrity_error", message=message) results = StudySchema(many=True).dump(studies) return results diff --git a/crc/services/study_service.py b/crc/services/study_service.py index a5193567..1e33ff57 100755 --- a/crc/services/study_service.py +++ b/crc/services/study_service.py @@ -44,7 +44,10 @@ class StudyService(object): @staticmethod def get_pb_min_date(): - pb_min_date = parser.parse(app.config['PB_MIN_DATE']) + try: + pb_min_date = parser.parse(app.config['PB_MIN_DATE']) + except Exception as e: + pb_min_date = datetime(2019, 1, 1) return pb_min_date def get_studies_for_user(self, user, categories, include_invalid=False): diff --git a/tests/study/test_study_api.py b/tests/study/test_study_api.py index 5434a536..e91ded73 100644 --- a/tests/study/test_study_api.py +++ b/tests/study/test_study_api.py @@ -217,7 +217,7 @@ def test_get_all_studies(self, mock_studies, mock_details, mock_docs, mock_inves num_open += 1 if study['id'] == 65432: # This study has `null` for DATELASTMODIFIED, so we should use the value in DATECREATED - self.assertEqual('2020-02-19T14:24:55.101695+00:00', study['last_updated']) + self.assertEqual('2020-02-19T14:24:55.101695-05:00', study['last_updated']) if study['id'] == 11111: self.assertTrue(False,"Study 11111 is too old to be processed and imported, it should be ignored.") db_studies_after = session.query(StudyModel).all()