namespace :video do desc "get video play data" task :data => :environment do start_time = ['2019-08-19 00:00:00', '2019-11-10 00:00:00'] end_time = ['2019-11-06 23:59:59', '2019-02-06 23:59:59'] Video.all.each do |video| vv = 0 play_duration = 0 end end end