Skip to content
Snippets Groups Projects
Commit f952b881 authored by anonymous's avatar anonymous
Browse files

fix empy serach range query

parent 49e1d998
No related branches found
No related tags found
No related merge requests found
......@@ -396,6 +396,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
except ValueError:
return search_params
empty_range = start_date and end_date and start_date > end_date
if not start_date and not end_date:
return search_params
......@@ -416,7 +418,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
start_date=start_date, end_date=end_date)
enclosing_query = ''
if do_enclosing_query:
if do_enclosing_query and not empty_range:
enclosing_query_start = 'extras_temporal_start:[* TO {start_date}]'.format(
start_date=start_date)
......
......@@ -52,6 +52,17 @@ class TestSearch(helpers.FunctionalTestBase):
# assert
assert dataset['name'] in response
@odsh_test()
def test_query_with_end_before_start_finds_no_dataset(self):
# arrange
datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31')
# act
response = self._perform_date_search('1960-12-30', '1960-02-01')
# assert
self._assert_no_results(response)
@odsh_test()
def test_query_with_wrong_dates_shows_error(self):
# arrange
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment