Commit 8f8c093b authored by Jérome Perrin's avatar Jérome Perrin

only use repr if the divergence looks like a divergence due to float rounding


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26113 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e1a0fb6e
...@@ -73,16 +73,22 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -73,16 +73,22 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
quantity = simulation_movement.getCorrectedQuantity() quantity = simulation_movement.getCorrectedQuantity()
d_error = simulation_movement.getDeliveryError() d_error = simulation_movement.getDeliveryError()
extra_parameters = dict()
if abs(quantity - d_quantity) < 1:
# if the difference between quantities are small, use repr to have more
# precise float display in the divergence message.
extra_parameters = dict(
decision_title=repr(d_quantity),
prevision_title=repr(quantity),)
message = DivergenceMessage(object_relative_url= delivery.getRelativeUrl(), message = DivergenceMessage(object_relative_url= delivery.getRelativeUrl(),
divergence_scope='quantity', divergence_scope='quantity',
simulation_movement = simulation_movement, simulation_movement = simulation_movement,
decision_value = d_quantity , decision_value = d_quantity ,
# use repr to have more precise float display
decision_title = repr(d_quantity),
prevision_value = quantity, prevision_value = quantity,
prevision_title = repr(quantity),
tested_property='quantity', tested_property='quantity',
message='Quantity', message='Quantity',
**extra_parameters
) )
......
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