Fix management of deletedContribution during sync process

This commit is contained in:
Benjamin Renard 2014-01-28 23:02:05 +01:00
parent 02521de7b4
commit 04db6c03db

View file

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