diff --git a/lib/tasks/competition_notice.rake b/lib/tasks/competition_notice.rake index 73db9b072..3cacd78d4 100644 --- a/lib/tasks/competition_notice.rake +++ b/lib/tasks/competition_notice.rake @@ -5,7 +5,7 @@ namespace :competition_notice do desc "竞赛通知-进入提交作品状态" task submit_work_begin: :environment do puts "__________#{Time.now.to_s}__submit_work_begin start______________________" - competitions = Project.find_by_sql("select * from competitions where status=1 and start_time >='#{(Time.now - 5.minutes).strftime('%Y-%m-%d %H:%i:00')}' and start_time <= '#{Time.now.strftime('%Y-%m-%d %H:%M:00')}' ") + competitions = Project.find_by_sql("select * from competitions where status=1 and start_time >='#{(Time.now - 5.minutes).strftime('%Y-%m-%d %H:%M:00')}' and start_time <= '#{Time.now.strftime('%Y-%m-%d %H:%M:00')}' ") competitions.each do |c| competition_teams = Project.find_by_sql("select * from competition_teams where competition_id=#{c.id} ") competition_teams.each do |team| @@ -18,7 +18,7 @@ namespace :competition_notice do desc "竞赛通知-截止提交作品时间前3小时" task submit_work_end: :environment do puts "__________#{Time.now.to_s}__submit_work_end start______________________" - competitions = Project.find_by_sql("select * from competitions where status=1 and end_time >='#{(Time.now + 3.hours - 5.minutes).strftime('%Y-%m-%d %H:%i:00')}' and end_time <= '#{(Time.now + 3.hours).strftime('%Y-%m-%d %H:%M:00')}' ") + competitions = Project.find_by_sql("select * from competitions where status=1 and end_time >='#{(Time.now + 3.hours - 5.minutes).strftime('%Y-%m-%d %H:%M:00')}' and end_time <= '#{(Time.now + 3.hours).strftime('%Y-%m-%d %H:%M:00')}' ") competitions.each do |c| competition_teams = Project.find_by_sql("select * from competition_teams where competition_id=#{c.id} ") competition_teams.each do |team| @@ -31,7 +31,7 @@ namespace :competition_notice do desc "竞赛通知-报名的竞赛进入成绩公示阶段" task submit_work_result: :environment do puts "__________#{Time.now.to_s}__submit_work_result start______________________" - competitions = Project.find_by_sql("select * from competitions where status=1 and review_time >='#{(Time.now - 5.minutes).strftime('%Y-%m-%d %H:00:00')}' and review_time <= '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}' ") + competitions = Project.find_by_sql("select * from competitions where status=1 and review_time >='#{(Time.now - 5.minutes).strftime('%Y-%m-%d %H:%M:00')}' and review_time <= '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}' ") competitions.each do |c| competition_teams = Project.find_by_sql("select * from competition_teams where competition_id=#{c.id} ") competition_teams.each do |team|