Commit c969c2b3 authored by Vincent Pelletier's avatar Vincent Pelletier

Make date constraint happen like any other column instead of making them a special case.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15863 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4b66bae6
...@@ -434,7 +434,7 @@ class SimulationTool(BaseTool): ...@@ -434,7 +434,7 @@ class SimulationTool(BaseTool):
sql_kw['input'] = input sql_kw['input'] = input
sql_kw['output'] = output sql_kw['output'] = output
query_list = [] column_value_dict = {}
if omit_mirror_date: if omit_mirror_date:
date_dict = {'query':[], 'operator':'and'} date_dict = {'query':[], 'operator':'and'}
...@@ -454,17 +454,11 @@ class SimulationTool(BaseTool): ...@@ -454,17 +454,11 @@ class SimulationTool(BaseTool):
date_dict['query'].append(at_date) date_dict['query'].append(at_date)
date_dict['range'] = 'ngt' date_dict['range'] = 'ngt'
if len(date_dict) : if len(date_dict) :
new_kw[table + '.date'] = date_dict column_value_dict['date'] = date_dict
else: else:
date_query_list = [] column_value_dict['date'] = {'query': [to_date], 'range': 'ngt'}
query_list.append(ComplexQuery( column_value_dict['mirror_date'] = {'query': [from_date], 'range': 'nlt'}
Query(range='ngt',
**{'%s.date' % table: [to_date]}),
Query(range='nlt',
**{'%s.mirror_date' % table: [from_date]}),
operator='AND'))
column_value_dict = {}
if resource_uid is not None : if resource_uid is not None :
column_value_dict['resource_uid'] = resource_uid column_value_dict['resource_uid'] = resource_uid
if section_uid is not None : if section_uid is not None :
...@@ -607,11 +601,7 @@ class SimulationTool(BaseTool): ...@@ -607,11 +601,7 @@ class SimulationTool(BaseTool):
else: else:
simulation_query = reserved_query simulation_query = reserved_query
if simulation_query is not None: if simulation_query is not None:
query_list.append(simulation_query) new_kw['query'] = simulation_query
if query_list:
new_kw['query'] = ComplexQuery(*query_list)
# It is necessary to use here another SQL query (or at least a subquery) # It is necessary to use here another SQL query (or at least a subquery)
# to get _DISTINCT_ uid from predicate_category table. # to get _DISTINCT_ uid from predicate_category table.
......
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