From 6a4408319747ffa422e4971917a714741f11fa05 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Mon, 11 Dec 2023 09:52:58 +0000 Subject: [PATCH] refactor: get_tasks_list --> get_task_id_list rename --- src/backend/app/projects/project_crud.py | 6 +++--- src/backend/app/submission/submission_crud.py | 4 ++-- src/backend/app/tasks/tasks_crud.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/app/projects/project_crud.py b/src/backend/app/projects/project_crud.py index 765c5bcdc7..a90e296baf 100644 --- a/src/backend/app/projects/project_crud.py +++ b/src/backend/app/projects/project_crud.py @@ -1371,8 +1371,8 @@ def generate_appuser_files( # Generating QR Code, XForm and uploading OSM Extracts to the form. # Creating app users and updating the role of that user. - get_task_lists_sync = async_to_sync(tasks_crud.get_task_lists) - task_list = get_task_lists_sync(db, project_id) + get_task_id_list_sync = async_to_sync(tasks_crud.get_task_id_list) + task_list = get_task_id_list_sync(db, project_id) # Run with expensive task via threadpool def wrap_generate_task_files(task): @@ -2024,7 +2024,7 @@ async def update_project_form( db.add(db_feature) db.commit() - tasks_list = await tasks_crud.get_task_lists(db, project_id) + tasks_list = await tasks_crud.get_task_id_list(db, project_id) for task in tasks_list: task_obj = await tasks_crud.get_task(db, task) diff --git a/src/backend/app/submission/submission_crud.py b/src/backend/app/submission/submission_crud.py index b44cb28c1e..dbadecc4b7 100644 --- a/src/backend/app/submission/submission_crud.py +++ b/src/backend/app/submission/submission_crud.py @@ -449,8 +449,8 @@ def get_all_submissions(db: Session, project_id): project = get_odk_project(odk_credentials) - get_task_lists_sync = async_to_sync(get_task_lists) - task_lists = get_task_lists_sync(db, project_id) + get_task_id_list_sync = async_to_sync(get_task_id_list) + task_lists = get_task_id_list_sync(db, project_id) submissions = project.getAllSubmissions(project_info.odkid, task_lists) return submissions diff --git a/src/backend/app/tasks/tasks_crud.py b/src/backend/app/tasks/tasks_crud.py index ca8c1cb4c1..0ab706de57 100644 --- a/src/backend/app/tasks/tasks_crud.py +++ b/src/backend/app/tasks/tasks_crud.py @@ -43,8 +43,8 @@ async def get_task_count_in_project(db: Session, project_id: int): return result.fetchone()[0] -async def get_task_lists(db: Session, project_id: int): - """Get a list of tasks for a project.""" +async def get_task_id_list(db: Session, project_id: int) -> list[int]: + """Get a list of tasks id for a project.""" query = text( """ SELECT id