Skip to content

Commit 1144950

Browse files
committed
Reworking 'New Completed Task' to include recurring tasks
1 parent ea81c08 commit 1144950

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

components/todoist/sources/completed-task/completed-task.mjs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,36 @@ export default {
55
key: "todoist-completed-task",
66
name: "New Completed Task",
77
description: "Emit new event for each completed task. [See the docs here](https://developer.todoist.com/sync/v8/#read-resources)",
8-
version: "0.0.6",
8+
version: "1.0.0",
99
type: "source",
1010
dedupe: "unique",
1111
methods: {
1212
...common.methods,
13-
isElementRelevant(element) {
14-
return element.checked;
13+
_getLastDate() {
14+
return this.db.get("lastDate");
15+
},
16+
_setLastDate(value) {
17+
this.db.set("lastDate", value);
18+
},
19+
async getSyncResult() {
20+
const lastDate = this._getLastDate();
21+
const items = await this.todoist.getCompletedTasks({
22+
params: {
23+
since: lastDate,
24+
annotate_items: true,
25+
},
26+
});
27+
28+
const newDate = new Date().toISOString();
29+
this._setLastDate(newDate);
30+
31+
console.log(items);
32+
return items;
33+
},
34+
filterResults(syncResult) {
35+
return syncResult
36+
.filter((element) =>
37+
this.todoist.isProjectInList(element.project_id, this.selectProjects ?? []));
1538
},
1639
},
1740
};

0 commit comments

Comments
 (0)