+

Fix management of deletedContribution during sync process

Benjamin Renard [2014-01-28 22:02:05]
Fix management of deletedContribution during sync process
Filename
mycoserver/group.py
diff --git a/mycoserver/group.py b/mycoserver/group.py
index 564faef..ff3c7d6 100644
--- a/mycoserver/group.py
+++ b/mycoserver/group.py
@@ -123,6 +123,8 @@ class Group(object):
     for uuid in group.deletedContributions:
       if uuid not in ret.deletedContributions:
         ret.deletedContributions[uuid]=group.deletedContributions[uuid]
+      elif ret.deletedContributions[uuid].lastChange<group.deletedContributions[uuid].lastChange:
+        ret.deletedContributions[uuid]=group.deletedContributions[uuid]

     ## Contributions
     for uuid in self.contributions:
@@ -132,12 +134,14 @@ class Group(object):
         ret.contributions[uuid]=self.contributions[uuid]
       elif self.contributions[uuid].lastChange>ret.deletedContributions[uuid].lastChange:
         ret.contributions[uuid]=self.contributions[uuid]
+        del ret.deletedContributions[uuid]
     for uuid in group.contributions:
       if uuid not in ret.contributions:
         if uuid not in ret.deletedContributions:
           ret.contributions[uuid]=group.contributions[uuid]
         elif group.contributions[uuid].lastChange>ret.deletedContributions[uuid].lastChange:
           ret.contributions[uuid]=group.contributions[uuid]
+          del ret.deletedContributions[uuid]

     return ret
ViewGit