Commit 6f19dd73 authored by Jérome Perrin's avatar Jérome Perrin

As divergence tester are predicates, test if they apply on the simulation...

As divergence tester are predicates, test if they apply on the simulation movements before explaining the divergence


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45811 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bbd11720
...@@ -239,17 +239,18 @@ class SolverProcess(XMLObject, ActiveProcess): ...@@ -239,17 +239,18 @@ class SolverProcess(XMLObject, ActiveProcess):
for movement in movement_list: for movement in movement_list:
for simulation_movement in movement.getDeliveryRelatedValueList(): for simulation_movement in movement.getDeliveryRelatedValueList():
for divergence_tester in simulation_movement.getParentValue().getSpecialiseValue()._getDivergenceTesterList(exclude_quantity=False): for divergence_tester in simulation_movement.getParentValue().getSpecialiseValue()._getDivergenceTesterList(exclude_quantity=False):
if divergence_tester.explain(simulation_movement) in (None, []): if divergence_tester.test(simulation_movement):
continue if divergence_tester.explain(simulation_movement) in (None, []):
application_list = map(lambda x:x.getRelativeUrl(), continue
solver_tool.getSolverDecisionApplicationValueList(movement, divergence_tester)) application_list = map(lambda x:x.getRelativeUrl(),
application_list.sort() solver_tool.getSolverDecisionApplicationValueList(movement, divergence_tester))
solver_list = solver_tool.searchTargetSolverList( application_list.sort()
divergence_tester, simulation_movement) solver_list = solver_tool.searchTargetSolverList(
solver_list.sort(key=lambda x:x.getId()) divergence_tester, simulation_movement)
solver_decision_key = (divergence_tester.getRelativeUrl(), tuple(application_list), tuple(solver_list)) solver_list.sort(key=lambda x:x.getId())
movement_dict = solver_decision_dict.setdefault(solver_decision_key, {}) solver_decision_key = (divergence_tester.getRelativeUrl(), tuple(application_list), tuple(solver_list))
movement_dict[simulation_movement] = None movement_dict = solver_decision_dict.setdefault(solver_decision_key, {})
movement_dict[simulation_movement] = None
# Now build the solver decision instances based on the previous # Now build the solver decision instances based on the previous
# grouping # grouping
......
...@@ -243,12 +243,13 @@ class RuleMixin(Predicate): ...@@ -243,12 +243,13 @@ class RuleMixin(Predicate):
""" """
result_list = [] result_list = []
for divergence_tester in self._getDivergenceTesterList( for divergence_tester in self._getDivergenceTesterList(
exclude_quantity=False): exclude_quantity=False):
result = divergence_tester.explain(movement) if divergence_tester.test(movement):
if isinstance(result, (list, tuple)): # for compatibility result = divergence_tester.explain(movement)
result_list.extend(result) if isinstance(result, (list, tuple)): # for compatibility
elif result is not None: result_list.extend(result)
result_list.append(result) elif result is not None:
result_list.append(result)
return result_list return result_list
# Placeholder for methods to override # Placeholder for methods to override
......
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