oppiliappan/dijo

Edit habit without deleting it/recreating to avoid losing history

lee-hodg opened this issue · 4 comments

Can I edit without having to delete? e.g. rename or change the daily goal?

This feature is in progress, over at the feature/edit branch.

Just stumbled upon this issue while looking for a rename functionality. Is the content in the branch still relevant?
I am interested in implementing this, but haven't yet dived into the source. Do you think you can give me some high level pointers on how you think this should work? Just two new set-{name,goal} commands?

Hi @atanunq,

The changes in that branch don't quite fit in with the new architecture I have in mind. Setting the name is fairly trivial (that is about as far as I got in that branch), but setting a goal is a little tricky:

  • a Bit habit has a goal of 1, and a Count habit has a goal of any integer that is not 1
  • changing a goal from 1 to, say 2, should change the habit type from Bit to Count (and if we get other habits down the line, maybe affect those as well)

I think the obvious solution is to error out when attempting to set goals that change the habit type, for which I am drafting a couple of changes right now (these changes accommodate new habit types as well). I think this will greatly help error messages returned by the command line, and improve the add and add-auto command as well.

However, I am very happy to see that you are interested in contributing to dijo!

I see. Thank you for the fast reply!