动态首页改变
This commit is contained in:
parent
aa86be1d8a
commit
10e24bebd5
|
@ -364,19 +364,20 @@ class CoursesService
|
|||
latest_course_dynamics = []
|
||||
latest_news = course.news.order("created_on desc").first
|
||||
unless latest_news.nil?
|
||||
latest_course_dynamics << {:type => 1,:time => latest_news.created_on,:message => l(:label_recently_updated_notification,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 1,:time => latest_news.created_on,
|
||||
:message =>latest_news.author.realname<< l(:label_recently_updated_notification,:locale => get_user_language(current_user))<<":"<< latest_news.title }
|
||||
end
|
||||
latest_message = course.journals_for_messages.order("created_on desc").first
|
||||
unless latest_message.nil?
|
||||
latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 2,:time => latest_message.created_on,:message =>latest_message.user.realname << l(:label_recently_updated_message,:locale => get_user_language(current_user))<<":"<<latest_message.notes}
|
||||
end
|
||||
latest_attachment = course.attachments.order("created_on desc").first
|
||||
unless latest_attachment.nil?
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message => l(:label_recently_updated_courseware,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message =>latest_attachment.author.realname<< l(:label_recently_updated_courseware,:locale => get_user_language(current_user))<<":"<<latest_attachment.filename}
|
||||
end
|
||||
latest_bid = course.homeworks.order('updated_on DESC').first
|
||||
unless latest_bid.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => latest_bid.author.realname<<l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<":"<<latest_bid.name}
|
||||
end
|
||||
|
||||
# Time 2015-04-07 14:58:30
|
||||
|
@ -416,7 +417,7 @@ class CoursesService
|
|||
end
|
||||
latest_homework_attach = homeworks.first
|
||||
unless latest_homework_attach.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message => l(:label_recently_updated_homework,:locale => get_user_language(current_user))}
|
||||
latest_course_dynamics << {:type => 4,:time => latest_homework_attach.updated_at,:message =>latest_homework_attach.user.realname<< l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<":"<<(latest_homework_attach.name.nil? ? latest_homework_attach.description : latest_homework_attach.name)}
|
||||
end
|
||||
latest_course_dynamics.sort!{|order,newer| newer[:time] <=> order[:time]}
|
||||
latest_course_dynamic = latest_course_dynamics.first
|
||||
|
|
Loading…
Reference in New Issue