From 840f26e3d3db2150598750f37319f18f0a34182d Mon Sep 17 00:00:00 2001 From: Younes Strittmatter Date: Mon, 20 May 2024 01:51:40 +0000 Subject: [PATCH] add approve all function on no code --- .../recruitment_manager/prolific/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py b/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py index 2150c1d..513bdcd 100644 --- a/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py +++ b/src/autora/experiment_runner/recruitment_manager/prolific/__init__.py @@ -171,12 +171,24 @@ def _request_return(id: str, prolific_token: str): _json=data, ) +def _approve(id: str, prolific_token: str): + __save_post( + f'https://api.prolific.com/api/v1/submissions/{sub["id"]}/transition/', + headers={"Authorization": f"Token {prolific_token}"}, + _json={"action": "APPROVE"} + ) + def request_return_all(study_id: str, prolific_token: str): submissions = _get_submissions_no_code_not_returned(study_id, prolific_token) for id in submissions: _request_return(id, prolific_token) +def approve_all_no_code(study_id: str, prolific_token: str): + subissions = _get_submissions_no_code_not_returned(study_id, prolific_token) + for id in submissions: + _approve(id, prolif) + def _update_study(study_id: str, prolific_token: str, **kwargs) -> bool: """