定时任务增加日志
This commit is contained in:
parent
69c63a523e
commit
1d7529b8d2
|
@ -3,6 +3,8 @@
|
|||
namespace :exercise_publish do
|
||||
desc "publish exercise and end exercise"
|
||||
task :publish => :environment do
|
||||
Rails.logger.info("log--------------------------------exercise_publish start")
|
||||
puts "--------------------------------exercise_publish start"
|
||||
exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
|
||||
exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 2)
|
||||
|
@ -11,6 +13,8 @@ namespace :exercise_publish do
|
|||
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
end
|
||||
Rails.logger.info("log--------------------------------exercise_publish end")
|
||||
puts "--------------------------------exercise_publish end"
|
||||
end
|
||||
|
||||
task :end => :environment do
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace :homework_evaluation do
|
|||
end
|
||||
#自动开启匿评的任务
|
||||
task :start_evaluation => :environment do
|
||||
Rails.logger.info("log--------------------------------start_evaluation start")
|
||||
puts "--------------------------------start_evaluation start"
|
||||
homework_detail_manuals = HomeworkDetailManual.where("evaluation_start = '#{Date.today}'")
|
||||
homework_detail_manuals.each do |homework_detail_manual|
|
||||
homework_common = homework_detail_manual.homework_common
|
||||
|
@ -67,6 +69,9 @@ namespace :homework_evaluation do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
Rails.logger.info("log--------------------------------start_evaluation end")
|
||||
puts "--------------------------------start_evaluation end"
|
||||
end
|
||||
|
||||
#自动关闭匿评的任务
|
||||
|
|
|
@ -42,6 +42,8 @@ namespace :homework_publishtime do
|
|||
end
|
||||
|
||||
task :end => :environment do
|
||||
puts "--------------------------------homework_publish_end start"
|
||||
Rails.logger.info("log--------------------------------homework_publish_end start")
|
||||
homework_commons = HomeworkCommon.where("end_time = '#{Date.today}'")
|
||||
homework_commons.each do |homework|
|
||||
if homework.anonymous_comment == 1
|
||||
|
@ -51,5 +53,7 @@ namespace :homework_publishtime do
|
|||
end
|
||||
end
|
||||
end
|
||||
Rails.logger.info("log--------------------------------homework_publish_end end")
|
||||
puts "--------------------------------homework_publish_end end"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue