From 4909c87a6f9beca8bf19651b94f802ddebd4e0b7 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Sat, 27 Apr 2024 13:18:37 +0800 Subject: [PATCH] fixes --- scripts/taskList.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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;