Skip to content

Commit

Permalink
task priority can be modified
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroBlackInk committed Apr 8, 2023
1 parent 2a8cdcc commit d30231d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ It should be the best Obsidian plugin for synchronizing Todoist tasks so far.
| Mark task as uncompleted |||
| Modify project | 🔜 | 🔜 |
| Modify section | 🔜 | 🔜 |
| Modify priority | 🔜 | 🔜 |
| Modify priority | | |
| Add reminder | 🔜 | 🔜 |
| Move tasks between files| 🔜 | 🔜 |
| Added-at date | 🔜 | 🔜 |
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "ultimate-todoist-sync",
"name": "Ultimate Todoist Sync",
"version": "1.0.32",
"version": "1.0.33",
"minAppVersion": "1.0.0",
"description": "This is the best Todoist task synchronization plugin for Obsidian so far.",
"author": "HeroBlackInk",
Expand Down
13 changes: 11 additions & 2 deletions src/syncModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ export class TodoistSync {
const dueDateModified = !(await this.taskParser.compareTaskDueDate(lineTask,savedTask))
//parent id 是否修改
const parentIdModified = !(lineTask.parentId === savedTask.parentId)
//check priority
const priorityModified = !(lineTask.priority === savedTask.priority)

try {
let contentChanged= false;
Expand All @@ -346,6 +348,7 @@ export class TodoistSync {
let statusChanged = false;
let dueDateChanged = false;
let parentIdChanged = false;
let priorityChanged = false;

let updatedContent = {}
if (contentModified) {
Expand Down Expand Up @@ -388,8 +391,14 @@ export class TodoistSync {
//parentIdChanged = false;
}

if (priorityModified) {

if (contentChanged || tagsChanged ||dueDateChanged ||projectChanged || parentIdChanged) {
updatedContent.priority = lineTask.priority
priorityChanged = true;
}


if (contentChanged || tagsChanged ||dueDateChanged ||projectChanged || parentIdChanged || priorityChanged) {
//console.log("task content was modified");
//console.log(updatedContent)
const updatedTask = await this.todoistRestAPI.UpdateTask(lineTask.todoist_id.toString(),updatedContent)
Expand All @@ -414,7 +423,7 @@ export class TodoistSync {



if (contentChanged || statusChanged ||dueDateChanged ||tagsChanged || projectChanged) {
if (contentChanged || statusChanged ||dueDateChanged ||tagsChanged || projectChanged || projectChanged) {
console.log(lineTask)
console.log(savedTask)
//`Task ${lastLineTaskTodoistId} was modified`
Expand Down

0 comments on commit d30231d

Please sign in to comment.