Commit 98325f34 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

drop abandoned experimental code.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32707 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d40a93f5
...@@ -485,8 +485,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated, ...@@ -485,8 +485,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated,
# gather delivery relations from simulation movements. # gather delivery relations from simulation movements.
delivery_dict = {} delivery_dict = {}
for s_m in simulation_movement_list: for s_m in simulation_movement_list:
for decision in decision_list:
s_m.appendDecision(decision)
delivery_path = s_m.getDelivery() delivery_path = s_m.getDelivery()
delivery_dict[delivery_path] = \ delivery_dict[delivery_path] = \
delivery_dict.get(delivery_path, []) + \ delivery_dict.get(delivery_path, []) + \
...@@ -513,9 +511,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated, ...@@ -513,9 +511,6 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated,
solve_result_list = [] solve_result_list = []
# accept + split # accept + split
for decision in [q for q in decision_list if q.decision != 'adopt']: for decision in [q for q in decision_list if q.decision != 'adopt']:
for simulation_movement in self.getDeliveryRelatedValueList(
portal_type='Simulation Movement'):
simulation_movement.appendDecision(decision)
if decision.decision == 'accept': if decision.decision == 'accept':
# accepting - in case of passed DeliverySolver use it, otherwise # accepting - in case of passed DeliverySolver use it, otherwise
# simply copy values to simulation # simply copy values to simulation
...@@ -532,5 +527,4 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated, ...@@ -532,5 +527,4 @@ class DeliveryLine(Movement, XMLObject, XMLMatrix, Variated,
adopt_decision_list = [q for q in decision_list \ adopt_decision_list = [q for q in decision_list \
if q.decision == 'adopt'] if q.decision == 'adopt']
if adopt_decision_list: if adopt_decision_list:
# XXX/FIXME appendDecision in this case
self._updatePropertyFromSimulation(adopt_decision_list) self._updatePropertyFromSimulation(adopt_decision_list)
...@@ -372,13 +372,6 @@ class Rule(Predicate, XMLObject): ...@@ -372,13 +372,6 @@ class Rule(Predicate, XMLObject):
m_quantity += movement.getQuantity() m_quantity += movement.getQuantity()
if m_quantity != prevision.get('quantity'): if m_quantity != prevision.get('quantity'):
# special case - quantity # special case - quantity
if movement.isPropertyForced('quantity'):
# TODO: support compensation if not prevent_compensation
LOG('%s:%s' % (self.getRelativeUrl(), movement.getRelativeUrl()), WARNING,
'Quantity forced to stay as %s, even if wanted %s' % (m_quantity, prevision.get('quantity')))
# DivergenceSolutionDecision mangle
pass
else:
q_diff = prevision.get('quantity') - m_quantity q_diff = prevision.get('quantity') - m_quantity
# try to find a movement that can be edited # try to find a movement that can be edited
for movement in p_matched_list: for movement in p_matched_list:
......
...@@ -571,38 +571,6 @@ class SimulationMovement(Movement, PropertyRecordableMixin): ...@@ -571,38 +571,6 @@ class SimulationMovement(Movement, PropertyRecordableMixin):
return False return False
return True return True
security.declareProtected( Permissions.ModifyPortalContent,
'appendDecision')
def appendDecision(self, decision):
"""Appends decision, optionally initialises"""
property = decision.divergence.tested_property
if getattr(aq_base(self), 'divergence_solution_history', None) is None:
# initialise divergence history mapping
self.divergence_solution_history = PersistentMapping()
if self.divergence_solution_history.get(property, None) is None:
self.divergence_solution_history[property] = WorkflowHistoryList()
self.divergence_solution_history[property].append(decision)
security.declareProtected( Permissions.AccessContentsInformation,
'isPropertyForced')
def isPropertyForced(self, property):
"""Check if property was forced by user"""
divergence_solution_history = getattr(aq_base(self),
'divergence_solution_history', None)
if divergence_solution_history is None:
return False
for decision in divergence_solution_history.get(property, [])[::-1]:
# fuzzy logic:
# * if there was accept decision with force - force
# * but if there was accept without force after - do not force
# To be discussed.
if decision.decision == 'accept':
if decision.force_property:
return True
return False
return False
def getSolverProcessValueList(self, movement=None, validation_state=None): def getSolverProcessValueList(self, movement=None, validation_state=None):
""" """
Returns the list of solver processes which are Returns the list of solver processes which are
......
...@@ -55,7 +55,6 @@ class SplitAndDefer(CopyToTarget): ...@@ -55,7 +55,6 @@ class SplitAndDefer(CopyToTarget):
applied_rule = simulation_movement.getParentValue() applied_rule = simulation_movement.getParentValue()
rule = applied_rule.getSpecialiseValue() rule = applied_rule.getSpecialiseValue()
expandable_property_list = [] expandable_property_list = []
forced_property_list = []
if getattr(rule, 'getExpandablePropertyList', None) is not None: if getattr(rule, 'getExpandablePropertyList', None) is not None:
expandable_property_list = rule.getExpandablePropertyList() expandable_property_list = rule.getExpandablePropertyList()
...@@ -86,24 +85,12 @@ class SplitAndDefer(CopyToTarget): ...@@ -86,24 +85,12 @@ class SplitAndDefer(CopyToTarget):
if prop not in movement_dict: # XXX: better way to filter out if prop not in movement_dict: # XXX: better way to filter out
movement_dict.update(**{ movement_dict.update(**{
prop: simulation_movement.getProperty(prop)}) prop: simulation_movement.getProperty(prop)})
if simulation_movement.isPropertyForced(prop):
# set same forcing on fresh movement - XXX might be good,
# might be wrong
forced_property_list.append(prop)
new_movement = applied_rule.newContent(**movement_dict) new_movement = applied_rule.newContent(**movement_dict)
new_movement.recordProperty('start_date') new_movement.recordProperty('start_date')
new_movement.recordProperty('stop_date') new_movement.recordProperty('stop_date')
new_movement.edit(start_date=self.start_date, new_movement.edit(start_date=self.start_date,
stop_date=self.stop_date) stop_date=self.stop_date)
new_movement.activate(**self.additional_parameters).expand() new_movement.activate(**self.additional_parameters).expand()
# XXX: start and stop date have to be forced on movement too
forced_property_list.extend(['start_date', 'stop_date'])
for prop in forced_property_list:
fake_divergence = DivergenceMessage()
fake_divergence.tested_property = prop
decision = DivergenceSolutionDecision(fake_divergence, 'accept', None, None,
True)
new_movement.appendDecision(decision)
else: else:
new_movement = applied_rule.newContent( new_movement = applied_rule.newContent(
portal_type="Simulation Movement", portal_type="Simulation Movement",
......
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