Ai
let allUsers = [];
let currentTodos = [];
let finishedTodos = [];
// add new user
const user = name => ({
name,
id: Math.ceil(Math.random()*10e8),
portfolio: [],
createDate: Date()
});
// push new user to array
const pushNewUserToAllUsers = name => {
allUsers.push(user(name))
};
// create new todo
const todo = title => ({
title,
id: Math.ceil(Math.random()*10e4),
in_work: false,
is_ready: false,
importance: 1,
start: function() {
return (this.in_work = true)
},
finish: function() {
return (this.is_ready = true)
},
createDate: Date.now()
});
// push new todo to array
const pushTodoToCurrentTodos = title => {
currentTodos.push(todo(title))
};
// user start do task
const userStartDoTask = (name, title) => {
for (let i = 0; i < allUsers.length; i++) {
if (allUsers[i].name === 'vasia')
{allUsers[i].portfolio.push(title)}
}
};
userStartDoTask('vasia', 'task N4');
// user finish do task
const userFinishDoTask = (name, title) => {
};