Skip to content

Commit

Permalink
Changed some queries to make them (hopefully) faster
Browse files Browse the repository at this point in the history
git-svn-id: file:///data/subversion/eol/trunk@2045 78829999-583a-0410-bd01-8a9b849fd409
  • Loading branch information
pleary committed Jun 10, 2010
1 parent 8b08a78 commit dcb023b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/models/page_name.rb
Expand Up @@ -5,8 +5,8 @@ class PageName < SpeciesSchemaModel

def self.page_names_for?(taxon_concept_id)
return PageName.count_by_sql(['SELECT 1 FROM taxon_concept_names tcn
JOIN page_names pn
USING (name_id)
STRAIGHT_JOIN page_names pn
ON (tcn.name_id=pn.name_id)
WHERE tcn.taxon_concept_id = ?
LIMIT 1', taxon_concept_id]) > 0
end
Expand Down
8 changes: 3 additions & 5 deletions app/views/navigation/_node_name_page.html.haml
@@ -1,10 +1,8 @@
- link_class = entry['has_content'] ? '' : 'light'
/ %a{:href => '', :class => link_class, :onclick => "update_browser(#{entry['id']}, 0); return false;"}
= link_to(entry['name_string'], {:controller => "taxa", :action => "show", :id => entry['taxon_concept_id'] }, :class => link_class, :onclick=>"showAjaxIndicator();")
/ - unless entry['rank_label'].blank?
/ %span.rank
/ = entry['rank_label']
-#- unless entry['rank_label'].blank?
-# %span.rank
-# = entry['rank_label']
- unless @in_hierarchy && entry['id'] == @hierarchy_entry.id
%a.expand{ :href => "JavaScript:displayNode(#{entry['id']})" }
+
2 changes: 1 addition & 1 deletion lib/category_content_builder.rb
Expand Up @@ -59,7 +59,7 @@ def biodiversity_heritage_library(options)
pt.details publication_details, ip.year item_year, ip.volume item_volume,
ip.issue item_issue, ip.prefix item_prefix, ip.number item_number, ip.url item_url
FROM taxon_concept_names tcn
JOIN page_names pn ON (tcn.name_id = pn.name_id)
STRAIGHT_JOIN page_names pn ON (tcn.name_id = pn.name_id)
JOIN item_pages ip ON (pn.item_page_id = ip.id)
JOIN title_items ti ON (ip.title_item_id = ti.id)
JOIN publication_titles pt ON (ti.publication_title_id = pt.id)
Expand Down

0 comments on commit dcb023b

Please sign in to comment.