kusold / todoist-habitrpg

One way sync from Todoist -> HabitRPG
120 stars 14 forks source link

Daily or to-do automatically turned into a habit and deleted name #34

Open cygnoir opened 9 years ago

cygnoir commented 9 years ago

Hi, all. I'm sorry to open another issue, but here I am.

I created either a daily or to-do today that was somehow turned into a habit. I have been revamping my tasks in Todoist today so I'm not sure which one it is, and its name was deleted. Here is its info:

{
  "text": "5baf4c65-ba28-425f-9932-ded840b97665",
  "challenge": {},
  "attribute": "str",
  "priority": 1,
  "value": 1,
  "tags": {},
  "notes": "This task was created by a third-party service. Feel free to edit, it won't harm the connection to that service. Additionally, multiple services may piggy-back off this task.",
  "dateCreated": "2015-01-15T15:29:05.273Z",
  "id": "5baf4c65-ba28-425f-9932-ded840b97665",
  "down": true,
  "up": true,
  "history": [
    {
      "date": 1421335745282,
      "value": 1
    }
  ],
  "type": "habit"
}

I'm not using any "third-party service" aside from this one so I'm not sure what happened here.

kusold commented 9 years ago

Yesterday while I was looking closer at the documentation I noticed that the way we are checking off ToDos is not actually the way are supposed to. We are using an API that is meant for signaling the direction for Habits. It's in my tasklist, but I'm not sure if I will be able to get with it tonight.

BTW, thank you @cygnoir! You are our best bug finder. :+1:

cygnoir commented 9 years ago

@Kusold You're welcome! I love helping to fix things and I sure do love HabitRPG. Also I'm glad to hear that I'm not just a big ol' pain the butt. ;)

crookedneighbor commented 9 years ago

@cygnoir @Kusold This habit was probably caused by todoist-habitrpg, but not necessarily so.

Every time a score function is sent to habit, it looks for task with the id submitted. If it does not exist, it creates a new habit using that id for the name and id. So if a task got deleted in HRPG, and todoist-habitrpg had a history for it and tried to resync it, it would become a habit (since it would send the old, deleted id).

However, some times that just randomly happens do to a sync error on the server. People who don't use any 3rd party addons get them from time to time. Regardless, it should be safe to delete it. If it reappears after the next sync, that'd be something to note. At that point, I'd probably make a copy of your .todoist-history file and poke around for that id and see what task it was assigned to previously. I use jsonformatter.curiousconcept.com to expand it and make it easier to read.

kusold commented 9 years ago

My theory on what happens: 1) A todo gets created. 2) The todo is scored 3) Cron removes the todo 4) We send the todo again to be scored. -> Habit is created

There is a step missing between 3 & 4 that I'm unsure about, but that's my theory.

It looks like I won't be able to just simply rip out the updateScore ( #4 ) and instead just use updateTask as I previously believed though.

cygnoir commented 9 years ago

Checking back in: I deleted it and it did not reappear. If another one appears, I will note it here.