当天截止的测验需要发布截止消息
This commit is contained in:
parent
03588ca88d
commit
06122dab1d
|
@ -3,9 +3,8 @@
|
||||||
namespace :exercise_deadline_warn do
|
namespace :exercise_deadline_warn do
|
||||||
desc "exercise deadline warn"
|
desc "exercise deadline warn"
|
||||||
task :deadline_warn => :environment do
|
task :deadline_warn => :environment do
|
||||||
exercises = Exercise.where("date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验
|
exercises = Exercise.where("exercise_status = 2 and date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验
|
||||||
exercises.each do |exercise|
|
exercises.each do |exercise|
|
||||||
if exercise.exercise_status == 2 #发布的作业才能告给学生发截止消息
|
|
||||||
course = exercise.course
|
course = exercise.course
|
||||||
course.members.each do |m|
|
course.members.each do |m|
|
||||||
#CourseMessage status 1 未发布 status 2 已发布 status 3 已发布快截止了
|
#CourseMessage status 1 未发布 status 2 已发布 status 3 已发布快截止了
|
||||||
|
@ -16,7 +15,6 @@ namespace :exercise_deadline_warn do
|
||||||
# end
|
# end
|
||||||
# 邮件通知
|
# 邮件通知
|
||||||
#Mailer.run.homework_added(homework)
|
#Mailer.run.homework_added(homework)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue