Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check as Done in Habitica #7

Open
ofekmiz opened this issue May 27, 2019 · 7 comments
Open

Check as Done in Habitica #7

ofekmiz opened this issue May 27, 2019 · 7 comments

Comments

@ofekmiz
Copy link

ofekmiz commented May 27, 2019

Suggestion: When a To-do in "doing" list is checked as done in Habitica, move it to "done" list

@alexktzk
Copy link
Owner

@ofekmiz Power Up currently works only one way, actions on cards in Trello affect todos in Habitica.

@ofekmiz
Copy link
Author

ofekmiz commented Jun 11, 2019

@alexktzk
I really wish we could find a way to implement this.
Trello's mobile app does not support this powerup like many others (and probably won't in the future), and before Trello I used to check my to-dos "on the go" through Habitica's app, now I can't since it won't sync with Trello.

So I've been thinking... maybe we can use Habitica's Webhooks feature? it might work, what do you think?

Webhook

@alexktzk
Copy link
Owner

@ofekmiz the power-up is served as a static content, not from the server. This means that we do not have a place where the Habitica request can be processed and used to generate the correct request for the Trello API to change the properties of the card.

  1. You can use a direct endpoint to the Trello API in your webhook, but in this case you'll need to know the card id, the list id to change and of course a fresh token to access the Trello API.

  2. Habitica webhooks are in beta as the API mentions. I tried to use webhooks and noticed that they sometimes not execute.

  3. Even the server wouldn't simplify this. When you try complete a card in Trello that was already marked as completed in Habitica you receive an error that says "Your session is outdated. Please refresh or sync.". It means you must update the card values in the power-up storage as well to get rid of this error. Problem is that I didn't find such enpoints for the storage in the API.

I personally think it's better to keep the power-up as simple as possible and stick to the one way flow from Trello to Habitica.

The easiest solution for you could be to use Trello from mobile web browser.

Please let me know if you find a simple solution.

@ofekmiz
Copy link
Author

ofekmiz commented Jun 11, 2019

The easiest solution for you could be to use Trello from mobile web browser.

That's what I do for now, far from perfect but I guess that's the best solution so far :)
Thanks for the detailed answer, if I find a better solution I'll let you know.

@alexktzk
Copy link
Owner

Yeah, it sucks, but I could not come up with a better solution either :)
You're welcome. Okay, thanks.

@ofekmiz
Copy link
Author

ofekmiz commented Jun 24, 2019

Hi @alexktzk :)
I went over the js files to maybe find a solution and I am not sure if I understand how the sync with Habitica works.

If I got it right, the powerup saves in storage a list of all the Habitica task ids and the card related to them. The powerup updates Habitica only when a card is moved to or from the "Doing"/"Done" list.
So if for example, I add a task called "cardX" in Trello "Doing" list, then go to Habitica and check that task, then go back to Trello and refresh the page - "cardX" will still be in the "Doing" list since it is saved in the storage. If now I move "cardX" to "Done" list I will get a "login error" and be asked to log in again because I am trying to update a task that no longer exists in Habitica.
(Hope I got it right 😊).

A solution for this can be adding a Sync button in the powerup settings that will go over all the Task IDs of the cards in the "Doing" lists and check if the task ID exists in the User Data from Habitica. If the task is not found or marked as "Done" in Habitica - archive it. This solution also works for syncing deleted tasks in Habitica. (We already get the user data with all the tasks anyway to get the user stats). The Sync button can also solve the "Stats out of sync" issue.

Since syncing with Habitica can be a heavy and slow operation sometimes it makes sense that the syncing is manual by demand of the user. Maybe we can also add an option in the settings to enable auto sync on page load once a day / every few hours, so if you checked a task in Habitica today, when you open Trello the next day it will be synced.

What do you think?

@alexktzk alexktzk reopened this Jun 27, 2019
@alexktzk
Copy link
Owner

Hi @ofekmiz! Sorry for the late answer.

Yeah, you've got it right, it works exactly like that :) I'm aware of the "login error" issue. It's because Habitica responds with 401 "Unauthorized" when you send request without user id and api token, which is totally ok. But it responds with 401 as well when you perform the steps which you described above. With the different error message though. Maybe it's better to distinguish errors by messages, not status codes.

I'm not a big fan of the manual sync but I suppose it's how Habitica works :) They have sync button in the official app so we probably should make one as well. Have you tried to add it already? If so please send PR.

I can add you to the trello board of this power-up to discuss the features there. Send me your trello username to [email protected] if interested and I'll invite you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants