updated taskList.js, fixed no return bugs
This commit is contained in:
parent
79303d750c
commit
601a81c38b
1 changed files with 5 additions and 6 deletions
|
|
@ -236,12 +236,12 @@ function addTask(username, userColor, task) {
|
|||
// removed task: success
|
||||
function removeTask(username, task) {
|
||||
const tasks = JSON.parse(localStorage.tasks);
|
||||
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
||||
|
||||
if (!tasks[username] || tasks[username].todos.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
||||
|
||||
// match regex: integers separated by space e.g. '1 2 3 4'
|
||||
if (task.match(/^(\d+ )*\d+$/)) {
|
||||
// insert commas between integers
|
||||
|
|
@ -373,13 +373,14 @@ function clearOwnDoneTasks(username) {
|
|||
// task: succcess
|
||||
function markTaskDone(username, task) {
|
||||
const tasks = JSON.parse(localStorage.tasks);
|
||||
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
||||
|
||||
// user does not have any tasks
|
||||
if (!tasks[username] || tasks[username].todos.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
||||
|
||||
// match regex: integers separated by space e.g. '1 2 3 4'
|
||||
if (task.match(/^(\d+ )*\d+$/)) {
|
||||
// insert commas between integers
|
||||
|
|
@ -782,9 +783,7 @@ function cancelAnimation() {
|
|||
}
|
||||
|
||||
(function () {
|
||||
// setupDB();
|
||||
resetDB();
|
||||
tests1();
|
||||
setupDB();
|
||||
importStyles();
|
||||
renderTaskListToDOM();
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue