From b94ea09c540f76b1c1041d7b78c05f0b162daeef Mon Sep 17 00:00:00 2001 From: M1kola Date: Tue, 9 May 2023 01:02:44 +0300 Subject: [PATCH] all completed tasks --- src/pages/Tracker/Tracker.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/pages/Tracker/Tracker.js b/src/pages/Tracker/Tracker.js index bbd14e32..d4b0ae1a 100644 --- a/src/pages/Tracker/Tracker.js +++ b/src/pages/Tracker/Tracker.js @@ -39,7 +39,7 @@ export const Tracker = () => { const [filteredAllTasks, setFilteredAllTasks] = useState([]); const [loader, setLoader] = useState(false); const [filterCompleteTasks, setFilterCompleteTasks] = useState([]); - // const [allCompletedTasks, setAllCompletedTasks] = useState([]) + const [allCompletedTasks, setAllCompletedTasks] = useState([]) const [modalCreateProject, setModalCreateProject] = useState(false); @@ -52,11 +52,16 @@ export const Tracker = () => { ).then((el) => { dispatch(setAllProjects(el.projects)); setLoader(false); - // setAllCompletedTasks(el.projects.filter((project) => { - // if (project.status === 10 && project.columns.length) { - // return project - // } - // }).map((project) => { return project.columns})) + setAllCompletedTasks(el.projects.filter((project) => { + if (project.status === 10 && project.columns.length) { + return project + } + }).map((project) => { return project.columns}).reduce((acu, curr) => { + curr.forEach((item) => { + acu.push(...item.tasks) + }) + return acu + }, [])) }); apiRequest( `/task/get-user-tasks?user_id=${localStorage.getItem("id")}`