jigarius / toggl2redmine

Import time from Toggl 2 Redmine.
GNU General Public License v3.0
26 stars 6 forks source link

Related TogglMapping not deleted when Redmine TimeEntry is deleted #30

Open yelidrissi opened 6 years ago

yelidrissi commented 6 years ago

If you import an item from Toggl. Then delete the item in redmine, then import again. The second import produces two messages. One saying it succeeded the other saying the import failed.

jigarius commented 6 years ago

I was looking for a "onModelDelete" kind of a hook so that I could delete the mapping between the Toggl time entry and the Redmine time entry when a Redmine time entry is deleted. If it is not possible to do this with a delete hook, I might have to resort to cron for cleaning dangling entries from the toggl_time_entries table. This will need some research. For now, if you face this problem, you can log time for that entry manually.

jigarius commented 4 years ago

Patched Redmine's TimeEntry model to define a one to many relationship with TogglMapping. When a TimeEntry is deleted, the associated TogglMapping models are also deleted. Thus, a user can import entries from Toggl, then delete the imported entries from Redmine if required and then re-import those entries with corrections.

jigarius commented 4 years ago

When a time entry is imported, then deleted using the Redmine report table (at the top), it still appears as "imported" in the Toggl report table (at the bottom). To address this issue, we can refresh the Toggl report when a deletion takes place.

jigarius commented 3 years ago

Now that we have tests in place, it will be fun to solve this problem for good 😃