Ad requirement 4

I have no idea how this requirement shall be implemented at the end, but at first step, the tiss_crawler.rb lib checks if the search_term is an empty string and returns an error msg if found

otherwise it returns the result, but appended to 'content' key
This commit is contained in:
Pfingstfrosch
2020-05-31 15:48:17 +02:00
parent 72b9f7d7a0
commit cfcbf5acdb
5 changed files with 43 additions and 9 deletions
@@ -7,7 +7,14 @@ class Crawlers::CoursesCrawlerController < Crawlers::TissCrawlerController
@host = TissCrawler.host
# TissCrawler performs general search over the available courses
@courses = TissCrawler.search(params)
result = TissCrawler.search(params)
if result.has_key? :error
flash[:alert] = 'Something went wrong! ' + result[:error]
redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
else
# TissCrawler performs general search over the available people
@courses = result[:content]
end
end
def show_detail
@@ -6,8 +6,16 @@ class Crawlers::PeopleCrawlerController < Crawlers::TissCrawlerController
puts params[:search_context]
@host = TissCrawler.host
# TissCrawler performs general search over the available people
@people = TissCrawler.search(params)
result = TissCrawler.search(params)
if result.has_key? :error
flash[:alert] = 'Something went wrong! ' + result[:error]
redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
else
# TissCrawler performs general search over the available people
@people = result[:content]
end
end
def show_detail
@@ -39,7 +47,7 @@ class Crawlers::PeopleCrawlerController < Crawlers::TissCrawlerController
else
flash[:alert] = 'Person is already favorited!'
end
redirect_back(fallback_location: search)
redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
end
end
@@ -6,7 +6,14 @@ class Crawlers::ProjectsCrawlerController < Crawlers::TissCrawlerController
@host = TissCrawler.host
# TissCrawler performs general search over the available projects
@projects = TissCrawler.search(params)
result = TissCrawler.search(params)
if result.has_key? :error
flash[:alert] = 'Something went wrong! ' + result[:error]
redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
else
# TissCrawler performs general search over the available people
@projects = result[:content]
end
end
def show_detail
@@ -6,7 +6,14 @@ class Crawlers::ThesesCrawlerController < Crawlers::TissCrawlerController
@host = TissCrawler.host
# TissCrawler performs general search over the available theses
@theses = TissCrawler.search(params)
result = TissCrawler.search(params)
if result.has_key? :error
flash[:alert] = 'Something went wrong! ' + result[:error]
redirect_back(fallback_location: crawlers_tiss_crawler_search_path)
else
# TissCrawler performs general search over the available people
@theses = result[:content]
end
end
def show_detail