未发布的作业不应给成员发消息
This commit is contained in:
parent
83ecb9c196
commit
74a3d361da
|
@ -160,24 +160,25 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
|
||||
def delay_homework_send
|
||||
if self.course
|
||||
if self.homework_detail_manual.comment_status != 0
|
||||
vs = []
|
||||
self.course.members.each do | m|
|
||||
if m.user_id != self.user_id
|
||||
vs << {course_message_type:'HomeworkCommon',course_message_id:self.id, :user_id => m.user_id,
|
||||
:course_id => self.course_id, :viewed => false}
|
||||
|
||||
vs = []
|
||||
self.course.members.each do | m|
|
||||
if m.user_id != self.user_id
|
||||
vs << {course_message_type:'HomeworkCommon',course_message_id:self.id, :user_id => m.user_id,
|
||||
:course_id => self.course_id, :viewed => false}
|
||||
|
||||
#delayed_job卡住的原因是一次执行的条数太多,导致超时。
|
||||
#现在把每次只执行不超过30条,就不会超了。
|
||||
if vs.size >= 30
|
||||
self.delay.contain_homework_message(vs)
|
||||
vs.clear
|
||||
#delayed_job卡住的原因是一次执行的条数太多,导致超时。
|
||||
#现在把每次只执行不超过30条,就不会超了。
|
||||
if vs.size >= 30
|
||||
self.delay.contain_homework_message(vs)
|
||||
vs.clear
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
unless vs.empty?
|
||||
self.delay.contain_homework_message(vs)
|
||||
unless vs.empty?
|
||||
self.delay.contain_homework_message(vs)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue