Skip to content

Commit

Permalink
starting expanded search. FAILS in rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
markwilkinson committed May 13, 2019
1 parent 23da322 commit 820783d
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MetricsEvaluatorCode/Ruby/fairmetrics/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ group :development, :test do
# Use Passenger as the app server
# gem 'passenger'
# Use Puma as the app server
# gem 'puma', '~> 3.7'
gem 'puma', '~> 3.7'
end

group :development do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,36 @@ def show

# POST /searches/1
def execute
logger.debug "BODY: #{request.body}\n\n\n"
#logger.debug "BODY: #{request.body}\n\n\n"
keywords = search_params[:keywords]
allkeys = keywords.split(",")
@metrics = Array.new
@collections = Array.new
@evaluations = Array.new
@evals_by_id = Array.new

@URL = request.original_url
allkeys.each do |key|
key.strip!
next unless key =~ /\w/
@metrics.concat(Metric.where("description LIKE ?", "%#{key}%"))
@metrics.concat(Metric.where("name LIKE ?", "%#{key}%"))
end
allkeys.each do |key|
key.strip!
next unless key =~ /\w/
@collections.concat(Collection.where("description LIKE ?", "%#{key}%"))
@collections.concat(Collection.where("name LIKE ?", "%#{key}%"))
end
allkeys.each do |key|
key.strip!
next unless key =~ /\w/
@evaluations.concat(Evaluation.where("title LIKE ?", "%#{key}%"))
end
allkeys.each do |key|
key.strip!
next unless key =~ /\w/
@evals_by_id.concat(Evaluation.where("resource LIKE ?", "%#{key}%"))
end

respond_to do |format|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,99 @@
<hr/>


<a name="evals_by_guid"><H3>Evaluations matched by GUID</H3></a>

<div style="padding-left: 50px;">
<% unless @evaluations.any? %>
<strong>NO MATCHES</strong>
<% end %>
<% @evals_by_id.each do |evalid| %>

<p>
<strong>Evaluation Identifier:</strong>
Evaluation #<a href="<%= evaluation_url(evalid.id) %>"><%= evalid.id %></a>
</p>

<p>
<strong>Name:</strong>
<%= evalid.title %>
</p>

<p>
<strong>GUID:</strong>
<%= evalid.resource %>
</p>

<p>
<strong>Contact:</strong>
<a href="https://orcid.org/<%= evalid.executor %>"><%= evalid.executor %></a>
</p>



<br/><br/>
<% end %>
</div>

<br/><br/>


<hr/>



<a name="evals_by_guid"><H3>Evaluations matched by Title</H3></a>

<div style="padding-left: 50px;">
<% unless @evaluations.any? %>
<strong>NO MATCHES</strong>
<% end %>
<% @evaluations.each do |evalz| %>

<p>
<strong>Evaluation Identifier:</strong>
Evaluation #<a href="<%= evaluation_url(evalz.id) %>"><%= evalz.id %></a>
</p>

<p>
<strong>Name:</strong>
<%= eval.title %>
</p>

<p>
<strong>GUID:</strong>
<%= eval.resource %>
</p>

<p>
<strong>Contact:</strong>
<a href="https://orcid.org/<%= evalz.executor %>"><%= evalz.executor %></a>
</p>



<br/><br/>
<% end %>
</div>

<br/><br/>

<hr/>














<br/>
<%= link_to 'Home', about_path %>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"updated-at": {"@id": "dct:modified", "@type": "xsd:date"},
"principle": {"@id": "sio:is-about", "@type": "xsd:anyURI"},
"test_of_metric": {"@id": "foaf:primaryTopic", "@type": "xsd:anyURI"},
"title": {"@id": "dct:title", "@type": "xsd:string},
"description": {"@id": "dct:description", "@type": "xsd:string},
"title": {"@id": "dct:title", "@type": "xsd:string"},
"description": {"@id": "dct:description", "@type": "xsd:string"},
"metrics": {"@id": "skos:member"},
"collections": {"@id": "skos:member"},
"primaryTopic": {"@id": "foaf:primaryTopic"},
Expand Down
5 changes: 5 additions & 0 deletions MetricsEvaluatorCode/Ruby/fairmetrics/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ production:
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
database: evaluator_production
<<<<<<< c803068fb7fdec0b9972dc2331079f9a389f3b6d
username: markw
password: markwongcloudapp
=======
username: root
password: fail
>>>>>>> starting expanded search. FAILS in rendering
socket: /cloudsql/ejp-evaluator:europe-west3:evaluator-mysql
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.web_console.whitelisted_ips = '138.4.137.74'

config.action_controller.default_url_options = { host: 'localhost', protocol: 'http', port: 3000}
config.action_controller.default_url_options = { host: 'localhost', protocol: 'http', port: 8080}


end
1 change: 1 addition & 0 deletions MetricsEvaluatorCode/Ruby/fairmetrics/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
get 'searches/:id', to: 'searches#show'

get 'schema', to: 'static_pages#schema'
get 'schema.json', to: 'static_pages#schema'

# API methods
namespace :v1, defaults: {format: 'json'} do
Expand Down

0 comments on commit 820783d

Please sign in to comment.