Skip to content

Commit

Permalink
[fix] sub-tasks not being pulled
Browse files Browse the repository at this point in the history
  • Loading branch information
hkgnp committed Apr 14, 2023
1 parent 3434cef commit ee90760
Show file tree
Hide file tree
Showing 4 changed files with 829 additions and 639 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "logseq-todoist-plugin",
"version": "5.2.1",
"version": "5.2.2",
"author": "hkgnp",
"description": "Simple Todoist plugin to pull only active tasks from specified project, i.e. Inbox",
"logseq": {
Expand All @@ -18,20 +18,20 @@
"license": "MIT",
"dependencies": {
"@doist/todoist-api-typescript": "^2.1.2",
"@logseq/libs": "^0.0.12",
"@logseq/libs": "^0.0.14",
"logseq-dateutils": "^0.0.26",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.2.4"
"tailwindcss": "^3.3.1"
},
"devDependencies": {
"@types/node": "^18.11.16",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"buffer": "^5.5.0",
"cssnano": "^5.1.14",
"parcel": "^2.8.2",
"postcss": "^8.4.20",
"@types/node": "^18.15.11",
"@types/react": "^18.0.35",
"@types/react-dom": "^18.0.11",
"buffer": "^6.0.3",
"cssnano": "^6.0.0",
"parcel": "^2.8.3",
"postcss": "^8.4.21",
"postcss-cli": "^10.1.0"
}
}
2 changes: 1 addition & 1 deletion src/App.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions src/services/todoistHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,19 @@ async function retrieveTasksHelper(flag: string) {
}
}

await recursion(parentTasks, allTasks);

async function recursion(
parentTasks: { content: string; children: any[]; todoistId: string }[],
parentTasks: {
content: string;
children: any[];
properties: { todoistid: string; attachments: any; comments: any };
}[],
allTasks: Task[]
) {
for (const t of allTasks) {
for (const u of parentTasks) {
if (t.parentId === u.todoistId) {
if (t.parentId == u.properties.todoistid) {
let obj = {
content: handleContentWithUrlAndTodo(t.content, t),
children: [],
Expand All @@ -166,14 +172,12 @@ async function retrieveTasksHelper(flag: string) {

u.children.push(finalObj);

recursion(u.children, allTasks);
await recursion(u.children, allTasks);
}
}
}
}

await recursion(parentTasks, allTasks);

if (logseq.settings!.retrieveClearTasks) {
allTasks.map(async (task) => await api.closeTask(task.id));
}
Expand Down
Loading

0 comments on commit ee90760

Please sign in to comment.