This commit is contained in:
huang 2015-12-24 16:10:41 +08:00
parent 8639609832
commit f7f03b2094
1 changed files with 9 additions and 3 deletions

View File

@ -59,9 +59,15 @@ module ApplicationHelper
end
# 获取项/课程 news最新列表
# params course ID or project ID
def news_act_order
# params course: course ID or project ID
def news_act_order(course)
a = []
course.news.each do |new|
unless new.comments.blank?
new = new.comments.sort! { |a,b| a.created_on <=> b.created_on}.last.commented
end
a << new
end
end
# Time 2015-03-24 16:38:05