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):
for movement in movement_list:
for simulation_movement in movement.getDeliveryRelatedValueList():
for divergence_tester in simulation_movement.getParentValue().getSpecialiseValue()._getDivergenceTesterList(exclude_quantity=False):
if divergence_tester.explain(simulation_movement) in (None, []):
continue
application_list = map(lambda x:x.getRelativeUrl(),
solver_tool.getSolverDecisionApplicationValueList(movement, divergence_tester))
application_list.sort()
solver_list = solver_tool.searchTargetSolverList(
divergence_tester, simulation_movement)
solver_list.sort(key=lambda x:x.getId())
solver_decision_key = (divergence_tester.getRelativeUrl(), tuple(application_list), tuple(solver_list))
movement_dict = solver_decision_dict.setdefault(solver_decision_key, {})
movement_dict[simulation_movement] = None
if divergence_tester.test(simulation_movement):
if divergence_tester.explain(simulation_movement) in (None, []):
continue
application_list = map(lambda x:x.getRelativeUrl(),
solver_tool.getSolverDecisionApplicationValueList(movement, divergence_tester))
application_list.sort()
solver_list = solver_tool.searchTargetSolverList(
divergence_tester, simulation_movement)
solver_list.sort(key=lambda x:x.getId())
solver_decision_key = (divergence_tester.getRelativeUrl(), tuple(application_list), tuple(solver_list))
movement_dict = solver_decision_dict.setdefault(solver_decision_key, {})
movement_dict[simulation_movement] = None
# Now build the solver decision instances based on the previous
# grouping
......
......@@ -243,12 +243,13 @@ class RuleMixin(Predicate):
"""
result_list = []
for divergence_tester in self._getDivergenceTesterList(
exclude_quantity=False):
result = divergence_tester.explain(movement)
if isinstance(result, (list, tuple)): # for compatibility
result_list.extend(result)
elif result is not None:
result_list.append(result)
exclude_quantity=False):
if divergence_tester.test(movement):
result = divergence_tester.explain(movement)
if isinstance(result, (list, tuple)): # for compatibility
result_list.extend(result)
elif result is not None:
result_list.append(result)
return result_list
# 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