Skip to content

Commit

Permalink
task duplication bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ledaryy committed Dec 9, 2022
1 parent 8fc5ea9 commit 4c18b76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
@@ -1,7 +1,7 @@
{
"id": "todoist-completed-tasks-plugin",
"name": "Todoist completed tasks",
"version": "1.4.0",
"version": "1.4.1",
"minAppVersion": "0.15.0",
"description": "Fetches completed tasks from todoist API and adds them to the Obsidian note.",
"author": "Andrey Kulishov",
Expand Down
4 changes: 3 additions & 1 deletion src/fetchTasks.ts
Expand Up @@ -85,16 +85,18 @@ export async function fetchTasks(
(task: RawTodoistTask) => task.parentId !== null
);

let queuedParentTasks = [] as string[];
childTasks.forEach((task: any) => {
const parentTask = mappedResults.find(
(t: RawTodoistTask) => t.taskId === task.parentId
);
if (!parentTask) {
if (!parentTask && !queuedParentTasks.includes(task.parentId)) {
let missedParentTask = fetchSingleTask(
authToken,
task.parentId
);
mappedResults.push(missedParentTask);
queuedParentTasks.push(task.parentId);
}
});
mappedResults = await Promise.all(mappedResults);
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Expand Up @@ -5,5 +5,6 @@
"1.1.2": "0.15.0",
"1.2.0": "0.15.0",
"1.3.0": "0.15.0",
"1.4.0": "0.15.0"
"1.4.0": "0.15.0",
"1.4.1": "0.15.0"
}

0 comments on commit 4c18b76

Please sign in to comment.