Commit 35aa1cab authored by Jérome Perrin's avatar Jérome Perrin

delete solver decision that are no longer applicable


git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37542 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0fccc15b
......@@ -249,6 +249,7 @@ class SolverProcess(XMLObject, ActiveProcess):
# Now build the solver decision instances based on the previous
# grouping
solver_decision_list = self.objectValues(portal_type='Solver Decision')
unmatched_solver_decision_list = set(solver_decision_list)
for solver_decision_key, movement_dict in solver_decision_dict.items():
causality, delivery_list, solver_list = solver_decision_key
movement_url_list = [x.getRelativeUrl() for x in movement_dict.keys()]
......@@ -257,6 +258,7 @@ class SolverProcess(XMLObject, ActiveProcess):
x for x in solver_decision_list \
if sorted(x.getDeliveryList()) == movement_url_list and \
x.getCausality() == causality]
unmatched_solver_decision_list.difference_update(matched_solver_decision_list)
if len(matched_solver_decision_list) > 0:
solver_decision_list.remove(matched_solver_decision_list[0])
else:
......@@ -282,8 +284,13 @@ class SolverProcess(XMLObject, ActiveProcess):
# if self not in solver_list:
# simulation_movement.setSolverValueList(
# solver_list + [self])
# XXX what should we do for non-matched existing solver decisions?
# do we need to cancel them by using an appropriate workflow?
# delete non-matched existing solver decisions, unless they have been
# solved already (we detect this by the fact that the solver decision is
# associated to a target solver)
self.manage_delObjects(ids=[x.getId() for x in
unmatched_solver_decision_list if not x.getCausality()])
def _generateRandomId(self):
# call ActiveProcess._generateRandomId() explicitly otherwise
......
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