Commit 148e8b26 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

get properties to be solved from divergence tester (target solver's causality's causality).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32268 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 58aa0461
......@@ -64,9 +64,9 @@ class AcceptSolver(SolverMixin, ConfigurableMixin, XMLObject):
Adopt new property to simulation movements, with keeping the
original one recorded.
"""
solved_property = self._getPortalTypeValue().getTestedProperty()
solved_property_list = self.getCausalityValue().getCausalityValue(). \
getTestedPropertyList()
for movement in self.getDeliveryValueList():
new_value = movement.getProperty(solved_property)
simulation_movement_list = movement.getDeliveryRelatedValueList()
# if movement here is a delivery, we need to find simulation
# movements by its movements.
......@@ -75,12 +75,15 @@ class AcceptSolver(SolverMixin, ConfigurableMixin, XMLObject):
[x.getDeliveryRelatedValueList() \
for x in self.getDeliveryValue().getMovementList()], [])
for simulation_movement in simulation_movement_list:
value_dict = {}
for solved_property in solved_property_list:
new_value = movement.getProperty(solved_property)
# XXX hard coded
if solved_property == 'quantity':
new_quantity = new_value * simulation_movement.getDeliveryRatio()
value_dict = {'quantity':new_quantity}
value_dict.update({'quantity':new_quantity})
else:
value_dict = {solved_property:new_value}
value_dict.update({solved_property:new_value})
self._solveRecursively(simulation_movement, value_dict)
simulation_movement.expand()
# Finish solving
......
......@@ -65,8 +65,10 @@ class AdoptSolver(SolverMixin, ConfigurableMixin, XMLObject):
"""
Adopt new property to movements or deliveries.
"""
solved_property = self._getPortalTypeValue().getTestedProperty()
solved_property_list = self.getCausalityValue().getCausalityValue(). \
getTestedPropertyList()
for movement in self.getDeliveryValueList():
for solved_property in solved_property_list:
# XXX hardcoded
if solved_property == 'quantity':
total_quantity = sum(
......
......@@ -62,7 +62,9 @@ class UnifySolver(AcceptSolver, AdoptSolver):
Adopt new property to simulation movements, with keeping the
original one recorded.
"""
solved_property = self._getPortalTypeValue().getTestedProperty()
# XXX it does not support multiple tested properties.
solved_property = self.getCausalityValue().getCausalityValue(). \
getTestedProperty()
for movement in self.getDeliveryValueList():
configuration_dict = self.getConfigurationPropertyDict()
new_value = configuration_dict.get('value')
......
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