Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
f952b881
Commit
f952b881
authored
6 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
fix empy serach range query
parent
49e1d998
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/plugin.py
+3
-1
3 additions, 1 deletion
ckanext/odsh/plugin.py
ckanext/odsh/tests/test_search.py
+11
-0
11 additions, 0 deletions
ckanext/odsh/tests/test_search.py
with
14 additions
and
1 deletion
ckanext/odsh/plugin.py
+
3
−
1
View file @
f952b881
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/tests/test_search.py
+
11
−
0
View file @
f952b881
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment