讨论区结构修改

任务中添加:自动开启/关闭匿评消息通知
匿评开启失败消息通知
This commit is contained in:
huang 2015-09-24 16:16:37 +08:00
parent c17a1555bf
commit 38ba47f8c8
3 changed files with 31 additions and 3 deletions

View File

@ -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

View File

@ -0,0 +1,5 @@
class AddReplyIdToMessage < ActiveRecord::Migration
def change
add_column :messages, :reply_id, :integer
end
end

View File

@ -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