Skip to content

Commit

Permalink
Merge pull request #2631 from MushroomObserver/njw-fix-location-merge…
Browse files Browse the repository at this point in the history
…-issue

Fix for location merge issue
  • Loading branch information
mo-nathan authored Jan 4, 2025
2 parents 904e657 + 915e400 commit 63fb38f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/helpers/tabs/observations_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,20 @@ def observations_at_where_tabs(query)
# these are from the observations form
def define_location_tab(query)
[:list_observations_location_define.l,
add_query_param(new_location_path(where: query.params[:user_where])),
add_query_param(new_location_path(where: where_param(query.params))),
{ class: tab_id(__method__.to_s) }]
end

# Hack to use the :locations param if it's present and the :user_where
# param is missing.
def where_param(query_params)
query_params[:user_where] || params[:where]
end

def assign_undefined_location_tab(query)
[:list_observations_location_merge.l,
add_query_param(matching_locations_for_observations_path(
where: query.params[:user_where]
where: where_param(query.params)
)),
{ class: tab_id(__method__.to_s) }]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ def test_index_where
login
get(:index, params: { where: location.name })
assert_displayed_title("Observations from #{location.name}")
assert_match(new_location_path(where: location.name), @response.body)
end

def test_index_where_page2
Expand Down

0 comments on commit 63fb38f

Please sign in to comment.