parent
c17a1555bf
commit
38ba47f8c8
|
@ -160,6 +160,7 @@ class MessagesController < ApplicationController
|
|||
@reply.safe_attributes = params[:reply]
|
||||
@reply.content = @quote + @reply.content
|
||||
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
|
||||
@reply.reply_id = @message.author
|
||||
@topic.children << @reply
|
||||
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
|
||||
user_activity.updated_at = Time.now
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddReplyIdToMessage < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :messages, :reply_id, :integer
|
||||
end
|
||||
end
|
|
@ -25,9 +25,25 @@ namespace :homework_evaluation do
|
|||
end
|
||||
end
|
||||
homework_detail_manual.update_column('comment_status', 2)
|
||||
# 匿评开启消息邮件通知
|
||||
# 匿评开启消息邮件通知,# 所有人
|
||||
course = homework_common.course
|
||||
course.members.each do |m|
|
||||
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
# 邮件通知
|
||||
Mailer.send_mail_anonymous_comment_close(homework_common).deliver
|
||||
else
|
||||
#作业数小于2,启动失败
|
||||
#作业数小于2,启动失败, 只给老师发
|
||||
# status==4 发送失败
|
||||
# 匿评开启消息邮件通知,# 所有人
|
||||
course = homework_common.course
|
||||
course.members.each do |m|
|
||||
if m.user.allowed_to?(:as_teacher,course)
|
||||
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 4)
|
||||
end
|
||||
end
|
||||
# 邮件通知
|
||||
# Mailer.send_mail_anonymous_comment_close(homework_common).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -47,7 +63,13 @@ namespace :homework_evaluation do
|
|||
student_work.save
|
||||
end
|
||||
homework_detail_manual.update_column('comment_status', 3)
|
||||
# 匿评关闭消息邮件通知
|
||||
# 匿评关闭消息通知 给所有人发
|
||||
course = homework_common.course
|
||||
course.members.each do |m|
|
||||
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
|
||||
end
|
||||
# 邮件通知
|
||||
Mailer.send_mail_anonymous_comment_close(homework_common).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue