diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 22aab5435..50496fbf8 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -113,12 +113,12 @@ class UsersController < ApplicationController forge_querys = @user.forge_messages user_querys = @user.user_feedback_messages forum_querys = @user.memo_messages - # if User.current.id == @user.id - # course_querys.update_all(:viewed => true) - # forge_querys.update_all(:viewed => true) - # user_querys.update_all(:viewed => true) - # forum_querys.update_all(:viewed => true) - # end + if User.current.id == @user.id + course_querys.update_all(:viewed => true) + forge_querys.update_all(:viewed => true) + user_querys.update_all(:viewed => true) + forum_querys.update_all(:viewed => true) + end @new_message_count = @user.forge_messages.count + @user.memo_messages.count + @user.course_messages.count + @user.user_feedback_messages.count case params[:type] when nil @@ -138,45 +138,58 @@ class UsersController < ApplicationController # @user_feedback_messages_count = @user_feedback_messages.count when 'homework' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_course_messages_count = @user_course_messages.count when 'course_message' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_course_messages_count = @user_course_messages.count when 'forge_message' @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_forge_messages_count = @user_forge_messages.count when 'course_news' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_course_messages_count = @user_course_messages.count when 'forge_news' @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_forge_messages_count = @user_forge_messages.count when 'course_news_reply' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") #@user_course_messages_count = @user_course_messages.count when 'forge_news_reply' @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_forge_messagess_count = @user_forge_messages.count when 'poll' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_course_messages_count = @user_course_messages.count when 'works_reviewers' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_course_messages_count = @user_course_messages.count when 'works_reply' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_course_messages_count = @user_course_messages.count when 'issue' @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_forge_messages_count = @user_forge_messages.count when 'issue_update' # 缺陷状态更新、留言 @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_forge_messages_count = @user_forge_messages.count when 'forum' @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_memo_messages_count = @user_memo_messages.count when 'user_feedback' @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + @message_alls_count = @message_alls.count #@user_feedback_messages_count = @user_feedback_messages.count else render_404 diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 231403575..1a1b06667 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -1,4 +1,4 @@ -