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
|
// removed task: success
|
||||||
function removeTask(username, task) {
|
function removeTask(username, task) {
|
||||||
const tasks = JSON.parse(localStorage.tasks);
|
const tasks = JSON.parse(localStorage.tasks);
|
||||||
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
|
||||||
|
|
||||||
if (!tasks[username] || tasks[username].todos.length === 0) {
|
if (!tasks[username] || tasks[username].todos.length === 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
||||||
|
|
||||||
// match regex: integers separated by space e.g. '1 2 3 4'
|
// match regex: integers separated by space e.g. '1 2 3 4'
|
||||||
if (task.match(/^(\d+ )*\d+$/)) {
|
if (task.match(/^(\d+ )*\d+$/)) {
|
||||||
// insert commas between integers
|
// insert commas between integers
|
||||||
|
|
@ -373,13 +373,14 @@ function clearOwnDoneTasks(username) {
|
||||||
// task: succcess
|
// task: succcess
|
||||||
function markTaskDone(username, task) {
|
function markTaskDone(username, task) {
|
||||||
const tasks = JSON.parse(localStorage.tasks);
|
const tasks = JSON.parse(localStorage.tasks);
|
||||||
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
|
||||||
|
|
||||||
// user does not have any tasks
|
// user does not have any tasks
|
||||||
if (!tasks[username] || tasks[username].todos.length === 0) {
|
if (!tasks[username] || tasks[username].todos.length === 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const incompleteTasks = tasks[username].todos.filter((t) => !t.done);
|
||||||
|
|
||||||
// match regex: integers separated by space e.g. '1 2 3 4'
|
// match regex: integers separated by space e.g. '1 2 3 4'
|
||||||
if (task.match(/^(\d+ )*\d+$/)) {
|
if (task.match(/^(\d+ )*\d+$/)) {
|
||||||
// insert commas between integers
|
// insert commas between integers
|
||||||
|
|
@ -782,9 +783,7 @@ function cancelAnimation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
// setupDB();
|
setupDB();
|
||||||
resetDB();
|
|
||||||
tests1();
|
|
||||||
importStyles();
|
importStyles();
|
||||||
renderTaskListToDOM();
|
renderTaskListToDOM();
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue