thomasklein / redmine2mite

Redmine2mite connects your Redmine account with your mite.account. Track your time easily on issues within Redmine and get them automatically send to mite.
http://mite.yo.lk/
MIT License
13 stars 6 forks source link

Double comment-entries and comment-entries from other mite-projects in mite after syncing data in redmine #11

Closed lbochsler closed 12 years ago

lbochsler commented 12 years ago

When I sync in Redmine ('Check data and synchronize'), the comments of mite-time-entries are appended with comments from other time-entries, even from other projects. It's very hard to find a way to reproduce which always behaves the same. Therefore I first would like to know if there is any known issue with that (haven't found anything here so far..)?

When synching again, another (same) comment will be added to the correct time-entry and also to many others from other projects (!). The mite-time-entry-comment looks like this afterwards (after synching twice):

Id: #1598 Issue: WYGIWYS: Zurück Taste Comment: Id: #1598 Issue: WYGIWYS: Zurück Taste Comment: Id: #1598 Issue: WYGIWYS: Zurück Taste Comment: Test/Debugging

We use Redmine: 1.2.1.stable

with

Redmine2mite - Yolk – Sebastian Munz & Julia Soergel GbR / Thomas Klein 1.2.1

Thanks for your info

Luke

thomasklein commented 12 years ago

Hi Luke!

I could reproduce it by synchronizing a couple of times in a row. Investigating...

thomasklein commented 12 years ago

Hi Luke! The current release should fix your issue. Best,
Thomas

lbochsler commented 12 years ago

Hi Thomas,

Thanks a lot for taking care of that! I just updated (from 1.2.1 to 1.3.2) this way:

Stopped webserver Replaced the old-version plugin code with the new one. Started webserver In Redmine /admin/plugins it still shows the old version Did a 'Check data and synchronize' in Redmine Error message: 'Could not update your account data' Did 'Check data and synchronize' again Sidenote: Configuration for Time Entry Note: Id: #{issue_id} Issue: {issue} Comment: {comment} Synchronization sucessful In Mite, the Test-Time-Entry is doubled and the placeholders for comments and so on are not substituted well:

  1. Jan 12 Test-Entry {Id: #650 Issue: Allgemeine interne Arbeiten (Ongoing) Comment: {comment}}
  2. Jan 12 Test-Entry {Id: #650 Issue: Allgemeine interne Arbeiten (Ongoing) Comment: {comment}}

Addition: The Time-Entry duplication happens only when syncing the first time after the update of the code.

Any idea?

lbochsler commented 12 years ago

Sorry, I see {comment} is not a placeholder anymore. So I still wonder why the whole comment is in curly brackets ( { ) and of course why I got doubled time entries ?

thomasklein commented 12 years ago

Hi Luke,

seems it was a bit too early to mark it resolved ; ) I couldn't reproduce the behaviour with the doubled time entry. Did it happen again or was it was the very first time? If so, it might have been a caching issue of rails or the Redmine-Plugin system. Not sure about it.

As for the placeholder: Yes I removed the {comment} placeholder as I wanted to find a way to check, if a time entry's comment send to mite already contains any replaced placeholders so that a double replacement won't happen. Therefore I added curly brackets around the replacements and check for their existence if time entries in Redmine are compared to time entries from mite during synchronization.

However, maybe this is not the final solution, as it takes away the freedom to totally customize the way a time entry's comment is built up. The problem I see, is that if at some point the "Configuration for the Time Entry Note" is changed and it synchronization takes place, how do I recursively know which part of the comment string contained the actual comment of the user and which part was the dynamically added information such as the {issue_id}.

If you have any suggestions on this I'm keen to hear about it!

Best, Thomas

lbochsler commented 12 years ago

Hi Thomas

As a workaround ok for me.

I don't know the exact architecture of the plugin and where the data is stored, but a future solution from my opinion should be to have the part of the comment string which contains the actual comment of the user stored separated from the information which is added dynamically. This means if no dynamic info is added to the comment field of a time entry in Redmine, the comment can always be distinguished between the dynamic info from Redmine. Further more because Redmine is master and mite slave, every time a sync is processed, the current user comment can be taken and the dynamic information is appended to it. Then the related mite time entry comment is replaced completely with these (originally) two parts from redmine (e.g. [user-comment] [dynamic-info]). From replacement excluded are the mite time entry comments of already 'closed' entries (this is the behaviour already now I guess)

Regards, Luke