This commit is contained in:
huang 2015-08-17 16:04:04 +08:00
parent a677119ba0
commit 472254019e
1 changed files with 14 additions and 13 deletions

View File

@ -108,24 +108,25 @@ class UsersController < ApplicationController
# querys.update_all(:viewed => true)
# end
if @user.course_messages
if params[:type].nil?
case params[:type]
when nil
@user_course_messages = @user.course_messages.reverse
@user_project_messges = @user.forge_messages.reverse
else
case params[:type]
when 'homework'
@user_course_messages = CourseMessage.where(:course_message_type => "HomeworkCommon", :user_id => @user)
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc")
when 'message'
@user_course_messages = CourseMessage.where(:course_message_type => "Message", :user_id => @user)
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
# @user_course_messages = CourseMessage.where(:course_message_type => "Message", :user_id => @user).reverse
when 'news'
@user_course_messages = CourseMessage.where(:course_message_type => "News", :user_id => @user)
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc")
when 'poll'
@user_course_messages = CourseMessage.where(:course_message_type => "Poll", :user_id => @user)
end
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
when ""
when 'issue'
@user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
end
respond_to do |format|
format.html{render :layout=>'base_users_new'}
format.api
end
end
end