Skip to content

Commit

Permalink
updated tasks list function
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Sep 5, 2023
1 parent 1074137 commit c430ea9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/backend/app/tasks/tasks_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,18 @@ async def get_task_count_in_project(db: Session, project_id: int):

def get_task_lists(db: Session, project_id: int):
"""Get a list of tasks for a project."""
query = f"""select id from tasks where project_id = {project_id}"""
result = db.execute(query)
tasks = [task[0] for task in result.fetchall()]
return tasks
query = text("""
SELECT id
FROM tasks
WHERE project_id = :project_id
""")

# Then execute the query with the desired parameter
result = db.execute(query, {"project_id": project_id})

# Fetch the result
task_ids = [row.id for row in result]
return task_ids


def get_tasks(
Expand Down

0 comments on commit c430ea9

Please sign in to comment.