作业列表设留言at消息为已读改为delay_job执行

This commit is contained in:
yuanke 2016-11-10 10:41:35 +08:00
parent 7e657a4ad0
commit 88d489b485
2 changed files with 10 additions and 4 deletions

View File

@ -34,11 +34,11 @@ class HomeworkCommonController < ApplicationController
@homeworks = paginateHelper @homework_commons,10 @homeworks = paginateHelper @homework_commons,10
#设置at已读 #设置at已读
@homeworks.each do |homework| @homeworks.each do |homework|
homework.journals_for_messages.each do |j| # homework.journals_for_messages.each do |j|
User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!} # User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
end # end
homework.delay.set_jour_viewed
end end
@left_nav_type = 3 @left_nav_type = 3
respond_to do |format| respond_to do |format|
format.js format.js

View File

@ -135,6 +135,12 @@ class HomeworkCommon < ActiveRecord::Base
# end # end
# end # end
def set_jour_viewed
self.journals_for_messages.each do |j|
User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
end
end
delegate :language_name, :language, :to => :homework_detail_programing delegate :language_name, :language, :to => :homework_detail_programing
end end