remove check for when a person only has invalid study types.

This commit is contained in:
danfunk 2023-12-05 12:34:00 -05:00
parent 8755bc8b29
commit cb91c2ba4a
3 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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):

View File

@ -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()