Skip to content
Snippets Groups Projects
Commit cce14991 authored by legton's avatar legton
Browse files

SCRUM#388: Change has_results to number_of_results

parent 99b6967d
No related branches found
No related tags found
No related merge requests found
...@@ -27,13 +27,8 @@ class V1::SearchController < ApplicationController ...@@ -27,13 +27,8 @@ class V1::SearchController < ApplicationController
# GET v1/search.json # GET v1/search.json
def index def index
search = SearchService.instance(@search, current_user).search search = SearchService.instance(@search, current_user).search
if ((search.results).empty?) @search.number_of_results = search.total_count
@search.has_results = false save_search()
save_search()
else
@search.has_results = true
save_search()
end
headers['X-Total-Count'] = search.total_count headers['X-Total-Count'] = search.total_count
render json: search.results, status: :ok render json: search.results, status: :ok
......
class AddHasResultsColumnToSearches < ActiveRecord::Migration[5.0]
def change
add_column :searches, :has_results, :boolean
end
end
class AddNumberOfResultsColumnToSearches < ActiveRecord::Migration[5.0]
def change
add_column :searches, :number_of_results, :integer
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment