optimization project helper.
This commit is contained in:
parent
5de8e1c2f2
commit
ae1fe0027a
|
@ -262,7 +262,12 @@ module ProjectsHelper
|
||||||
# @projects_status = @projects_status.reorder('grade').all.reverse
|
# @projects_status = @projects_status.reorder('grade').all.reverse
|
||||||
# Project.joins(@projects_status).limit(10)
|
# Project.joins(@projects_status).limit(10)
|
||||||
limit = 10
|
limit = 10
|
||||||
Project.find_by_sql("SELECT * FROM projects RIGHT OUTER JOIN (SELECT * FROM project_statuses ORDER BY grade DESC LIMIT #{limit} ) AS t ON projects.id = t.project_id ")
|
#Project.find_by_sql("SELECT * FROM projects RIGHT OUTER JOIN (SELECT * FROM project_statuses ORDER BY grade DESC LIMIT #{limit} ) AS t ON projects.id = t.project_id ")
|
||||||
|
Project.find_by_sql("
|
||||||
|
SELECT p.id, p.name, p.description, p.identifier, t.project_id
|
||||||
|
FROM projects AS p RIGHT OUTER JOIN (
|
||||||
|
SELECT project_id,grade FROM project_statuses
|
||||||
|
WHERE project_type = 0 ORDER BY grade DESC LIMIT #{limit} ) AS t ON p.id = t.project_id ")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,13 +100,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<!-- info display block -->
|
||||||
<%= stylesheet_link_tag 'welcome' %>
|
<%= stylesheet_link_tag 'welcome' %>
|
||||||
<div class="body_resize">
|
<div class="body_resize">
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<div class="home"><%= l :label_hot_project%></div>
|
<div class="home"><%= l :label_hot_project%></div>
|
||||||
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[5]) %>
|
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[5]) %>
|
||||||
<div class="project">
|
<div class="project">
|
||||||
<%=link_to( project.name, project_path(project), :class => "nowrap" )%>
|
<%=link_to( project.name, project_path(project.project_id), :class => "nowrap" )%>
|
||||||
<p><%= project.description %></p>
|
<p><%= project.description %></p>
|
||||||
<!-- span class="grey"><strong><em> </em></strong></span -->
|
<!-- span class="grey"><strong><em> </em></strong></span -->
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue