Fix management of deletedContribution during sync process
Benjamin Renard

Benjamin Renard commited on 2014-01-28 22:02:05
Showing 1 changed files, with 4 additions and 0 deletions.

... ...
@@ -123,6 +123,8 @@ class Group(object):
123 123
     for uuid in group.deletedContributions:
124 124
       if uuid not in ret.deletedContributions:
125 125
         ret.deletedContributions[uuid]=group.deletedContributions[uuid]
126
+      elif ret.deletedContributions[uuid].lastChange<group.deletedContributions[uuid].lastChange:
127
+        ret.deletedContributions[uuid]=group.deletedContributions[uuid]
126 128
 
127 129
     ## Contributions
128 130
     for uuid in self.contributions:
... ...
@@ -132,12 +134,14 @@ class Group(object):
132 134
         ret.contributions[uuid]=self.contributions[uuid]
133 135
       elif self.contributions[uuid].lastChange>ret.deletedContributions[uuid].lastChange:
134 136
         ret.contributions[uuid]=self.contributions[uuid]
137
+        del ret.deletedContributions[uuid]
135 138
     for uuid in group.contributions:
136 139
       if uuid not in ret.contributions:
137 140
         if uuid not in ret.deletedContributions:
138 141
           ret.contributions[uuid]=group.contributions[uuid]
139 142
         elif group.contributions[uuid].lastChange>ret.deletedContributions[uuid].lastChange:
140 143
           ret.contributions[uuid]=group.contributions[uuid]
144
+          del ret.deletedContributions[uuid]
141 145
 
142 146
     return ret
143 147
 
144 148