no_evaluation=CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?",User.current.id,@homework.course,"NoEvaluation",0)
no_evaluation=CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =? and status =?",User.current.id,@homework.course,"StudentWork",0,0)
no_evaluation.update_all(:viewed=>true)
# 作品留言
# 消息end
@ -144,6 +144,10 @@ class StudentWorkController < ApplicationController
end
defnew
#更新消息
noEvaluation=@homework.course_messages.where("user_id =? and viewed =?",User.current.id,0)
@ -128,7 +128,7 @@ class UsersController < ApplicationController
#课程相关消息
when'homework'
@message_alls=CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','NoEvaluation') and user_id =?",@user).order("created_at desc")
@message_alls=CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork') and user_id =?",@user).order("created_at desc")
when'course_message'
@message_alls=CourseMessage.where("course_message_type =? and user_id =?","Message",@user).order("created_at desc")