diff --git a/lib/planner/tasks.ex b/lib/planner/tasks.ex index a587998..946189c 100644 --- a/lib/planner/tasks.ex +++ b/lib/planner/tasks.ex @@ -38,7 +38,9 @@ defmodule Planner.Tasks do t in Task, join: pd in PlanDetail, on: t.id == pd.task_id, - where: (pd.plan_id == ^plan_id and is_nil(t.finished_at)) or t.id == ^task_id, + where: (pd.plan_id == ^plan_id and is_nil(t.finished_at)) + or + (pd.plan_id == ^plan_id and t.id == ^task_id), order_by: [desc: t.updated_at] ) diff --git a/lib/planner_web/live/tasks_live.ex b/lib/planner_web/live/tasks_live.ex index 2e5f727..5aee936 100644 --- a/lib/planner_web/live/tasks_live.ex +++ b/lib/planner_web/live/tasks_live.ex @@ -187,7 +187,7 @@ defmodule PlannerWeb.TasksLive do end def handle_event("finish-task", %{"task-id" => task_id}, socket) do - {_, task} = Tasks.finish_task_by_id!(task_id) + {_, _} = Tasks.finish_task_by_id!(task_id) route = get_index_route(socket) {:noreply, push_patch(socket, to: route)} end