Closed wizonesolutions closed 11 years ago
Goal 1 achieved.
Next goal is to now not add tasks that already exist.
@lefnire said that the ability to add arbitrary properties via the API would be around for a bit, so I'm just going to do that. Something like last_sync
(ISO-8601 timestamp, courtesy of Moment), from_api
(rtm), remote_api_id
(the taskseries
ID).
wtf? taskseries
? Yeah, I'm not going to go into RTM internals here. Some things don't map 1:1. No clue what I'm going to do about recurring tasks. IMO those should either be dailies or ignored. Also I should fill in the due date field from RTM. But that's like...goal 7.
Wait, we can add our own properties? Is that via PUT and POST? Holy smokes! I have to code now!
@pjf You inspired me to believe this, actually, when you said that PUT
bestowed superpowers.
Opened #2. Don't need to deal with recurring tasks yet. Those are the exception, and not having them is not doing to make me miss out on tons of XP. I actually have very few recurring tasks these days. I use Dailies a lot more now. Way more fun, and if you don't do them they just reset instead of hanging around.
Goal 2 achieved! OK, next goal is to delete tasks that have been deleted on the RTM side. Hmm...I might have to implement #3 for this. Well, better now than never.
Alright, #3 done and working on deleting tasks on our end that have been deleted on the RTM side. RTM helpfully tells us all the deleted taskseries
object per list when we specify last_sync
. So just a matter of going through these. Goal 3 is nigh.
Oops...that was the wrong issue number...
Goal 3 appears achieved. I feel like I am going to run into all kinds of annoying edge cases, but this feature will likely get some debugging as I test the next steps.
The final step to call this v1 is to complete remote RTM tasks when they are completed in Habit. This is actually a little tricky.
I'm going to store an hts_known_complete
property on the tasks I add, which will be "uncompleted" by default. It will compare this to its actual status, and if it differs it will blindly try to delete the task on the RTM side. If it gets an error, it will just ignore it and keep going.
One problem is what to do if a task has been completed on our end but deleted remotely. Actually, I guess it's alright to delete it. We've already gotten the credit for it in that case.
Also need to filter for incomplete tasks only. ALWAYS. I might need to ignore smart lists too, but that isn't priority 1.
Hmm, status:incomplete
in the filter might filter out the deleted tasks too. Need to test this.
Now I've got authentication working for both APIs and can pull tasks from Habit.
Copy-pasting the plan I typed to myself on IRC:
Elaborating on this, I think goal 1 is actually just to add all tasks to Habit wholesale. Don't even compare. Goal 2 is to compare and not double-add, and so on. So all_goals++;
I am psyched.