diff --git a/scripts/taskList.js b/scripts/taskList.js index e2f79c3..3d67529 100644 --- a/scripts/taskList.js +++ b/scripts/taskList.js @@ -966,7 +966,7 @@ function focusTask(username, task) { }; } - if (task.includes(",")) { + if (taskSeparator.some((separator) => task.includes(separator))) { return { status: 1, body: { @@ -1029,6 +1029,17 @@ function focusTask(username, task) { }; } + // if task is already completed, return 2 + if (tasks[username].todos[index].done) { + return { + status: 2, + body: { + "error message": `@${username} task is already completed`, + error: responses.specifyFocusTask, + }, + }; + } + // set all tasks to unfocused for (const task of tasks[username].todos) { task.focus = false;