jackba / worktime

Automatically exported from code.google.com/p/worktime
0 stars 0 forks source link

Wrong synchronization result for ongoing TR's #190

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When syncing a bunch of time registrations following can happen:

This list is incoming on the server:
1. TR1 finished
2. TR2 finished
3. TR3 finished

On the server we have this data:
1. TR1 finished
2. TR2 finished
3. TR3 ongoing

Thus we go over all the TR's and the first TR that will be checked is (by 
accident so far) the TR3. So TR3 is checked agains the server DB, and the value 
in the server DB is updated.

But here comes the problem if the data is like this:

This list is incoming on the server:
1. TR1 finished
2. TR2 finished
3. TR3 finished

On the server we have this data:
1. TR1 finished
2. TR2 ongoing

So now the first TR to be checked is TR3 (again this is by accident the last 
one always now, can be different depending on the client, if different then the 
first case that now succeeds will also fail!). But no similar TR is found so 
the server looks for interfering TR's... Guess what, he finds TR3 as 
interfering TR. If in this case the server wins, the TR3 will not be accepted...

So instead before syncing all TR's, we should check if on the server there is 
an ongoing TR. If so we should search for a similar TR (based on the sync-key) 
in the list of incoming TR and sync that particular TR first. Afterwards all 
others can be synced.

Original issue reported on code.google.com by dirkvran...@gmail.com on 6 Feb 2013 at 1:51

GoogleCodeExporter commented 9 years ago

Original comment by dirkvran...@gmail.com on 6 Feb 2013 at 2:51