Commit 649a5769 authored by Julien Muchembled's avatar Julien Muchembled

Fix update of not yet indexed root simulation movements

parent 37cc2b2c
...@@ -169,17 +169,27 @@ class MovementCollectionUpdaterMixin: ...@@ -169,17 +169,27 @@ class MovementCollectionUpdaterMixin:
movement.edit(**kw) movement.edit(**kw)
for property_id in kw: for property_id in kw:
movement.clearRecordedProperty(property_id) movement.clearRecordedProperty(property_id)
for movement in movement_diff.getNewMovementList(): movement_list = movement_diff.getNewMovementList()
if not movement_list:
return
if context.isRootAppliedRule():
reindex_kw = {'activate_kw': {
'tag': 'built:' + context.getCausalityValue().getPath()}}
else:
reindex_kw = None
def newMovement(kw={}):
return context.newContent(portal_type=self.movement_type,
reindex_kw=reindex_kw, **kw)
for movement in movement_list:
d = movement.__dict__ d = movement.__dict__
assert movement.isTempObject() assert movement.isTempObject()
if '_original' in d: if '_original' in d:
# slow but safe way (required for compensated movements) # slow but safe way (required for compensated movements)
context.newContent(portal_type=self.movement_type, newMovement(_getPropertyAndCategoryList(movement))
**_getPropertyAndCategoryList(movement))
continue continue
# fast way (we had to make sure such optimization # fast way (we had to make sure such optimization
# does not touch existing persistent data) # does not touch existing persistent data)
del movement.__dict__ del movement.__dict__
movement = context.newContent(portal_type=self.movement_type) movement = newMovement()
d.update(movement.__dict__) d.update(movement.__dict__)
movement.__dict__ = d movement.__dict__ = d
...@@ -715,8 +715,8 @@ return context.generatePredicate( ...@@ -715,8 +715,8 @@ return context.generatePredicate(
"""Check that simulation is indexed before being updated """Check that simulation is indexed before being updated
It is important that an update of a simulation tree is able to find all It is important that an update of a simulation tree is able to find all
related simulation movements, otherwise the following happends: related simulation movements, otherwise the following happens:
node 1 node2 2 node 1 node 2
start first indexing of SM ... start first indexing of SM ...
change simulation state of PL change simulation state of PL
update simulation (no SM found) update simulation (no SM found)
...@@ -733,7 +733,7 @@ return context.generatePredicate( ...@@ -733,7 +733,7 @@ return context.generatePredicate(
r, = self.portal.cmf_activity_sql_connection.manage_test( r, = self.portal.cmf_activity_sql_connection.manage_test(
'select * from message_queue') 'select * from message_queue')
self.assertEqual(r.method_id, '_updateSimulation') self.assertEqual(r.method_id, '_updateSimulation')
expectedFailure(self.assertEqual)(r.processing_node, -1) self.assertEqual(r.processing_node, -1)
def test_suite(): def test_suite():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment