Commit 82cd6365 authored by Michael Rose's avatar Michael Rose

search: minor optimization of render speed

parent 5bfcdd25
......@@ -2,7 +2,7 @@ require 'pp'
module SearchHelper
def story_pp(story)
story.pretty_inspect
''
end
def extract_names(vals, join_char=' ')
......
......@@ -75,10 +75,11 @@
</div>
<div class="panel-footer small">
<%
selected_fandoms = if @search
story_fandoms = story_result.fandoms
selected_fandoms = if @search
@search.fandoms
else
[story_result.fandoms[0].id]
[story_fandoms[0].id]
end
selected_crossovers = if @search
@search.crossovers
......@@ -86,10 +87,10 @@
[]
end
fandom = story_result.fandoms
fandom = story_fandoms
.select { |f| selected_fandoms.include?(f.id) }
.first
crossover = story_result.fandoms
crossover = story_fandoms
.select { |f| f != fandom }
.first
%>
......@@ -99,7 +100,7 @@
<%= fandom.name %> x <%= crossover.name %>
<% else %>
<i class="fa fa-book"></i>
<%= story_result.fandoms[0].name %>
<%= story_fandoms[0].name %>
<% end %>
-
<% elsif (selected_crossovers.size > 0 or (@fandoms && @fandoms.include?(-1))) && crossover %>
......@@ -110,10 +111,10 @@
<% unless @fandoms %>
<% if story_result.crossover? %>
<i class="fa fa-random"></i>
<%= story_result.fandoms.map(&:name).join(' x ') %>
<%= story_fandoms.map(&:name).join(' x ') %>
<% else %>
<i class="fa fa-book"></i>
<%= story_result.fandoms[0].name %>
<%= story_fandoms[0].name %>
<% end %>
-
<% end %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment