toggl2redmine
toggl2redmine copied to clipboard
Related TogglMapping not deleted when Redmine TimeEntry is deleted
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.
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.
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.
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.
Now that we have tests in place, it will be fun to solve this problem for good 😃