This commit is contained in:
liyunze 2024-04-27 13:18:37 +08:00
parent 45c394881f
commit 4909c87a6f

View file

@ -966,7 +966,7 @@ function focusTask(username, task) {
}; };
} }
if (task.includes(",")) { if (taskSeparator.some((separator) => task.includes(separator))) {
return { return {
status: 1, status: 1,
body: { 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 // set all tasks to unfocused
for (const task of tasks[username].todos) { for (const task of tasks[username].todos) {
task.focus = false; task.focus = false;