diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 703917c4e..849df24b2 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -159,11 +159,12 @@ module WelcomeHelper end def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=15 - 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 = #{project_type} ORDER BY #{order_by} LIMIT #{limit} ) AS t ON p.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 = #{project_type} ORDER BY #{order_by} LIMIT #{limit} ) AS t ON p.id = t.project_id ") + Project.joins(:project_status).where("#{Project.table_name}.project_type = ?", project_type).order(order_by).limit(limit).all end def sort_bid_by_hot_rails reward_type, limit = 10 diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index a23459149..99f9a5c31 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -292,13 +292,13 @@
- <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}")%> - + <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}")%> + <%= content_tag "span", show_grade(project), :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :class => "tooltip", - :id => "tooltip-#{project.project_id}" %> + :id => "tooltip-#{project.id}" %>
<%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %> @@ -326,7 +326,7 @@
- <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%> + <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%> 学生人数:<%= link_to "#{studentCount(project)}", project_member_path(project, :role => 2) ,:course =>'1'%>