冲突解决

This commit is contained in:
cxt 2016-04-13 16:58:44 +08:00
parent 2befcd6634
commit f97699037b
1 changed files with 3 additions and 3 deletions

View File

@ -232,10 +232,10 @@
<% if @user.projects.visible.count > 0
project_order_ids = "(" +
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
(SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
ForgeActivity.find_by_sql("SELECT p.project_id, p.updated_at FROM
(SELECT fa.project_id, MAX(fa.updated_at) AS updated_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
GROUP BY fa.project_id) AS p
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"
ORDER BY p.updated_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"
projects = Project.where("projects.id in #{project_order_ids}")
else
projects = []