Commit bda0a771 authored by Vincent Pelletier's avatar Vincent Pelletier

Optimise the case where catalog returns no line.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18511 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8c012345
...@@ -371,6 +371,8 @@ def sumCatalogResultByWorklist(grouped_worklist_dict, catalog_result): ...@@ -371,6 +371,8 @@ def sumCatalogResultByWorklist(grouped_worklist_dict, catalog_result):
flexibility point of view: if it must ever be changed into a cursor, this flexibility point of view: if it must ever be changed into a cursor, this
code will keep working nicely without needing to rewind the cursor. code will keep working nicely without needing to rewind the cursor.
""" """
worklist_result_dict = {}
if len(catalog_result) > 0:
# List all unique criterions in criterion_id_list # List all unique criterions in criterion_id_list
criterion_id_dict = {} criterion_id_dict = {}
for worklist in grouped_worklist_dict.itervalues(): for worklist in grouped_worklist_dict.itervalues():
...@@ -397,7 +399,6 @@ def sumCatalogResultByWorklist(grouped_worklist_dict, catalog_result): ...@@ -397,7 +399,6 @@ def sumCatalogResultByWorklist(grouped_worklist_dict, catalog_result):
criterion_value_to_worklist_key_dict[criterion_value_key].append( criterion_value_to_worklist_key_dict[criterion_value_key].append(
worklist_id) worklist_id)
# Read catalog result and distribute to matching worklists # Read catalog result and distribute to matching worklists
worklist_result_dict = {}
for result_line in catalog_result: for result_line in catalog_result:
criterion_value_key = tuple([result_line[x] for x in criterion_id_list]) criterion_value_key = tuple([result_line[x] for x in criterion_id_list])
if criterion_value_key not in criterion_value_to_worklist_key_dict: if criterion_value_key not in criterion_value_to_worklist_key_dict:
......
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