remove check for when a person only has invalid study types.
This commit is contained in:
parent
8755bc8b29
commit
cb91c2ba4a
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -217,7 +217,7 @@ class TestStudyApi(BaseTest):
|
|||
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()
|
||||
|
|
Loading…
Reference in New Issue