From 911a75e8b07673d6590cbd97a6c301333881c774 Mon Sep 17 00:00:00 2001 From: Younes Strittmatter Date: Tue, 16 Jul 2024 11:39:59 -0400 Subject: [PATCH] Update __init__.py --- .../recruitment_manager/prolific/__init__.py | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py b/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py index 470c23f..1dd36ca 100644 --- a/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py +++ b/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py @@ -272,6 +272,7 @@ def setup_study( device_compatibility: List[str] = ["desktop"], peripheral_requirements=None, temp_file='', + check_prev=True, ) -> Any: """ @@ -320,25 +321,28 @@ def setup_study( vision_eligibility, language_eligibility, ] - if _is_study_uncompleted(name, prolific_token): - still_uncomplete = True - for i in range(10): - time.sleep(30) - still_uncomplete = still_uncomplete and _is_study_uncompleted(name, prolific_token) + if check_prev: + if _is_study_uncompleted(name, prolific_token): + still_uncomplete = True + for i in range(10): + time.sleep(30) + still_uncomplete = still_uncomplete and _is_study_uncompleted(name, prolific_token) + if still_uncomplete: + _approve_study_incompleted_submissions(name, prolific_token) + still_uncomplete = still_uncomplete and _is_study_uncompleted(name, prolific_token) + if not still_uncomplete: + break if still_uncomplete: - _approve_study_incompleted_submissions(name, prolific_token) - still_uncomplete = still_uncomplete and _is_study_uncompleted(name, prolific_token) - if not still_uncomplete: - break - if still_uncomplete: - print('ERROR: There is a study with this name that is not completed. Can not proceed.') - return - previous_studies = _list_studies(prolific_token) - excludes = [ - {"name": s["name"], "id": s["id"]} - for s in previous_studies - if s["name"] in exclude_studies - ] + print('ERROR: There is a study with this name that is not completed. Can not proceed.') + return + previous_studies = _list_studies(prolific_token) + excludes = [ + {"name": s["name"], "id": s["id"]} + for s in previous_studies + if s["name"] in exclude_studies + ] + else: + excludes = exclude_studies if excludes is not []: eligibility_requirements += [EligibilityOptions.previous_studies(excludes)] if device_compatibility is None: