From f56d9ed26500832fcc3c49dd863b89ea519e23c0 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 25 Aug 2015 16:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BD=9C=E4=B8=9A=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84forge=5Fmessages=E8=A1=A8=E7=9A=84viewed?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 01f858442..1af832b79 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -11,6 +11,13 @@ class StudentWorkController < ApplicationController protect_from_forgery :except => :set_program_score def index + #设置作业对应的forge_messages表的viewed字段 + query_student_work = @homework.course_messages + query_student_work.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end + end @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @is_teacher = User.current.allowed_to?(:as_teacher,@course) course_group = CourseGroup.find_by_id(@group) if @group