Commit 5ef82cd8 authored by Jérome Perrin's avatar Jérome Perrin

absolute tolerance and absolute quantity are not needed, the same result can be

obtained by setting the same values in range_min and range_max


git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37567 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1803a530
...@@ -102,7 +102,6 @@ ...@@ -102,7 +102,6 @@
<list> <list>
<string>my_tested_property</string> <string>my_tested_property</string>
<string>my_tested_property_title</string> <string>my_tested_property_title</string>
<string>my_quantity</string>
<string>my_quantity_range_min</string> <string>my_quantity_range_min</string>
<string>my_quantity_range_max</string> <string>my_quantity_range_max</string>
</list> </list>
...@@ -113,7 +112,6 @@ ...@@ -113,7 +112,6 @@
<value> <value>
<list> <list>
<string>my_tolerance_base</string> <string>my_tolerance_base</string>
<string>my_tolerance</string>
<string>my_tolerance_range_min</string> <string>my_tolerance_range_min</string>
<string>my_tolerance_range_max</string> <string>my_tolerance_range_max</string>
</list> </list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_quantity</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_quantity</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Absolute Tolerance</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_tolerance</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_percent</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Relative Tolerance</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -85,8 +85,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -85,8 +85,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
# XXX we should use appropriate property sheets and getter methods # XXX we should use appropriate property sheets and getter methods
# for these properties. # for these properties.
# Maybe, but beware of default values of quantity when doing so # Maybe, but beware of default values of quantity when doing so
absolute_tolerance_min = self.getProperty('quantity_range_min') or \ absolute_tolerance_min = self.getProperty('quantity_range_min')
self.getProperty('quantity')
if absolute_tolerance_min is not None and \ if absolute_tolerance_min is not None and \
delta < absolute_tolerance_min: delta < absolute_tolerance_min:
return ( return (
...@@ -94,8 +93,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -94,8 +93,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
'The difference of ${property_name} between decision and prevision is less than ${value}.', 'The difference of ${property_name} between decision and prevision is less than ${value}.',
dict(property_name=tested_property, dict(property_name=tested_property,
value=absolute_tolerance_min)) value=absolute_tolerance_min))
absolute_tolerance_max = self.getProperty('quantity_range_max') or \ absolute_tolerance_max = self.getProperty('quantity_range_max')
self.getProperty('quantity')
if absolute_tolerance_max is not None and \ if absolute_tolerance_max is not None and \
delta > absolute_tolerance_max: delta > absolute_tolerance_max:
return ( return (
...@@ -142,8 +140,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -142,8 +140,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
base = prevision_value base = prevision_value
if base is not None: if base is not None:
relative_tolerance_min = self.getProperty('tolerance_range_min') or \ relative_tolerance_min = self.getProperty('tolerance_range_min')
self.getProperty('tolerance')
if relative_tolerance_min is not None and \ if relative_tolerance_min is not None and \
delta < relative_tolerance_min * base: delta < relative_tolerance_min * base:
return ( return (
...@@ -151,8 +148,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin): ...@@ -151,8 +148,7 @@ class FloatEquivalenceTester(Predicate, EquivalenceTesterMixin):
'The difference of ${property_name} between decision and prevision is less than ${value} times of the prevision value.', 'The difference of ${property_name} between decision and prevision is less than ${value} times of the prevision value.',
dict(property_name=tested_property, dict(property_name=tested_property,
value=relative_tolerance_min)) value=relative_tolerance_min))
relative_tolerance_max = self.getProperty('tolerance_range_max') or \ relative_tolerance_max = self.getProperty('tolerance_range_max')
self.getProperty('tolerance')
if relative_tolerance_max is not None and \ if relative_tolerance_max is not None and \
delta < relative_tolerance_max * base: delta < relative_tolerance_max * base:
return ( return (
......
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