From 5a6764952140e89135674891316369a273e57837 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 26 Oct 2019 18:42:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9poll=5Fpublish=5Frake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/poll_publish.rake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/tasks/poll_publish.rake b/lib/tasks/poll_publish.rake index 8cec43565..90772c3c7 100644 --- a/lib/tasks/poll_publish.rake +++ b/lib/tasks/poll_publish.rake @@ -83,7 +83,7 @@ namespace :poll_publish do end task :end => :environment do - + puts "--------------------------------poll_publish end start" #1.统一设置的截止 polls = Poll.includes(:poll_users).where("polls_status = 2 AND unified_setting = true AND end_time <=?",Time.now + 900) polls.each do |poll| @@ -98,7 +98,9 @@ namespace :poll_publish do polls_group_settings.each do |poll_setting| poll = poll_setting.poll if poll&.end_time <= Time.now + poll.update_column('polls_status', 3) + puts "########__________________############{poll.polls_status}" end users = poll.course.course_members.where(course_group_id: poll_setting.course_group_id) poll.poll_users.where(user_id: users.pluck(:user_id)).where("commit_status = 0 and start_at is not null").update_all(commit_status: 1, end_at: Time.now) @@ -107,7 +109,10 @@ namespace :poll_publish do # poll_user.update_attributes(:commit_status => 1, :end_at => Time.now) # end # end + end + puts "--------------------------------poll_publish end end" + # PollGroupSetting.where("end_time < ? and end_time > ?", Time.now + 1800, Time.now - 1800).each do |poll_setting| # poll = poll_setting.poll