开启/关闭匿评消息通知

This commit is contained in:
huang 2015-09-18 17:49:19 +08:00
parent 850a7c937f
commit ff2e3e168d
1 changed files with 11 additions and 10 deletions

View File

@ -206,8 +206,7 @@ class HomeworkCommonController < ApplicationController
end
@homework_detail_manual.update_column('comment_status', 2)
@statue = 1
# send_message_homework(@homework)
else
@statue = 2
end
@ -219,13 +218,6 @@ class HomeworkCommonController < ApplicationController
#关闭匿评
def stop_anonymous_comment
@homework_detail_manual.update_column('comment_status', 3)
# 关闭匿评消息提示
# status 标记匿评状态 1为关闭 0为开启
course = @homework.course
course.student.each do |st|
@homework.course_messages << CourseMessage.new(:user_id => st.user_id, :course_id => course.id, :viewed => false, :status => false)
end
# end
#计算缺评扣分
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@homework.student_works.each do |student_work|
@ -233,12 +225,21 @@ class HomeworkCommonController < ApplicationController
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
# send_message_homework(@homework)
respond_to do |format|
format.js
end
end
# 开启/关闭匿评消息通知
# def send_message_homework(homework)
# # status 标记匿评状态 1为关闭 0为开启
# course = @homework.course
# course.student.each do |st|
# @homework.course_messages << CourseMessage.new(:user_id => st.user_id, :course_id => course.id, :viewed => false, :status => false)
# end
# end
#提示
def alert_anonymous_comment
@cur_size = 0