通知提醒规则更改5分钟

This commit is contained in:
xiaoxiaoqiong 2022-03-02 16:55:33 +08:00
parent fbd1533a53
commit 643dedc8cb
1 changed files with 3 additions and 3 deletions

View File

@ -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|