From 9aa4af883a665613cfb001c526990bcd5c82bf15 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Fri, 15 Sep 2023 23:31:15 +0800 Subject: [PATCH] fixed check command --- scripts/taskList.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/taskList.js b/scripts/taskList.js index 76bfc2c..965d2c6 100644 --- a/scripts/taskList.js +++ b/scripts/taskList.js @@ -636,9 +636,16 @@ function editTask(username, message) { // 0: user has no tasks function checkTasks(username) { const tasks = JSON.parse(localStorage.tasks); + + // Go through keys of tasks, find match of lowercased username + username = Object.keys(tasks).find( + (user) => user.toLowerCase() === username.toLowerCase() + ); + if (!tasks[username]) { return 0; } + // filter completed tasks const incompleteTasks = tasks[username].todos.filter((t) => !t.done); const completedTasks = tasks[username].todos.filter((t) => t.done);