热门项目排序添加空值判断,默认按活跃度排序

GitlabVersion
z9hang 11 years ago
parent ab05bf6f36
commit 2cab9f7895

@ -32,7 +32,9 @@ class WelcomeController < ApplicationController
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
where("#{Project.table_name}.project_type = ? and #{Project.table_name}.id in (?)", Project::ProjectType_project,@hot_projects_ids)
if @first_page.nil? || @first_page.sort_type.nil?
@projects = @projects_all.order("grade desc")
else
case @first_page.sort_type
when 0
@projects = @projects_all.order("created_on desc")
@ -53,6 +55,8 @@ class WelcomeController < ApplicationController
end
end
end
def robots
@projects = Project.all_public.active
render :layout => false, :content_type => 'text/plain'

Loading…
Cancel
Save