Commit 5476509b authored by Nicolas Dumazet's avatar Nicolas Dumazet

getAggregatedAmountList: iterate and filter instead of expand and filter

It is not necessary to build the entire list of transformation lines,
we can just examine and filter each line, as they are yielded


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31477 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 74c06a53
......@@ -245,19 +245,6 @@ class Transformation(XMLObject, Predicate, Variated):
with the quantity of the context
"""
context = self.asContext(context=context, REQUEST=REQUEST, **kw)
# First we need to get the list of transformations which this
# transformation depends on
# At this moment, we only consider 1 dependency
template_transformation_list = self.getSpecialiseValueList()
result = AggregatedAmountList()
# Browse all involved transformations and create one line per
# line of transformation
# Currently, we do not consider abstractions, we just add
# whatever we find in all transformations
transformation_line_list = []
for transformation in ([self]+template_transformation_list):
transformation_line_list.extend(transformation.objectValues())
# A list of functions taking a transformation_line as sole argument
# and returning True iif the line should be kept in the result
......@@ -295,11 +282,22 @@ class Transformation(XMLObject, Predicate, Variated):
return False
return True
for transformation_line in transformation_line_list:
# Browse each transformed or assorted resource of the current
# transformation
if line_is_included(transformation_line):
result.extend(transformation_line.getAggregatedAmountList(context))
# First we need to get the list of transformations which this
# transformation depends on
# At this moment, we only consider 1 dependency
template_transformation_list = self.getSpecialiseValueList()
# Browse all involved transformations and create one line per
# line of transformation
# Currently, we do not consider abstractions, we just add
# whatever we find in all transformations
result = AggregatedAmountList()
for transformation in ([self] + template_transformation_list):
for transformation_line in transformation.objectValues():
# Browse each transformed or assorted resource of the current
# transformation
if line_is_included(transformation_line):
result.extend(transformation_line.getAggregatedAmountList(context))
if context_quantity:
result.multiplyQuantity(context=context)
......
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