禁用匿评的作业在截止时作业状态变为3
This commit is contained in:
parent
8fa790dd6b
commit
3f60893591
|
@ -1,7 +1,7 @@
|
||||||
#coding=utf-8
|
#coding=utf-8
|
||||||
|
|
||||||
namespace :homework_publishtime do
|
namespace :homework_publishtime do
|
||||||
desc "start publish homework"
|
desc "start publish homework and end homework"
|
||||||
task :publish => :environment do
|
task :publish => :environment do
|
||||||
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
|
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
|
||||||
homework_commons.each do |homework|
|
homework_commons.each do |homework|
|
||||||
|
@ -20,4 +20,16 @@ namespace :homework_publishtime do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task :end => :environment do
|
||||||
|
homework_commons = HomeworkCommon.where("end_time < '#{Date.today}'")
|
||||||
|
homework_commons.each do |homework|
|
||||||
|
if homework.anonymous_comment == 1
|
||||||
|
homework_detail_manual = homework.homework_detail_manual
|
||||||
|
if homework_detail_manual.comment_status == 1
|
||||||
|
homework_detail_manual.update_column('comment_status', 3)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue