app/controllers/article_threads_controller.rb
# add artilces to make banner shcedule when schedule time is over multiple days.
add artilces to make banner shcedule when schedule time is over multiple days.
add artilces to make banner shcedule when schedule time is over multiple days .
def add_extra_schedule_articles
    latest_article = @thread.articles(:order => "articles.id DESC").first
    s_time, e_time = latest_article.start_datetime, latest_article.end_datetime
    s_time or return 
    unless [s_time.year, s_time.yday] == [e_time.year, e_time.yday]
      Article.update latest_article.id, :banner_run_id => latest_article.run_id
    end
    article_attrs = latest_article.attributes
    s_time = (s_time + 1.day).beginning_of_day
    while s_time < e_time do 
      additional_article = @thread.articles.build article_attrs.merge(:start_datetime => s_time,
                                                                      :end_datetime   => e_time,
                                                                      :is_news        => false,
                                                                      :banner_run_id  => latest_article.run_id) 
      additional_article.set_schedule_time_attrs
      additional_article.create_run!
      s_time += 1.day
    end     
  end
def add_extra_schedule_articles latest_article = @thread . articles ( :order => "articles.id DESC" ) . first s_time , e_time = latest_article . start_datetime , latest_article . end_datetime s_time or return unless [ s_time . year , s_time . yday ] == [ e_time . year , e_time . yday ] Article . update latest_article . id , :banner_run_id => latest_article . run_id end article_attrs = latest_article . attributes s_time = ( s_time + 1 . day ) . beginning_of_day while s_time < e_time do additional_article = @thread . articles . build article_attrs . merge ( :start_datetime => s_time , :end_datetime => e_time , :is_news => false , :banner_run_id => latest_article . run_id ) additional_article . set_schedule_time_attrs additional_article . create_run! s_time += 1 . day end end
add artilces to make banner shcedule when schedule time is over multiple days.
add artilces to make banner shcedule when schedule time is over multiple days .
# do nothing # over a day ? # force to set banner.