<commit_before># Homepage
class HomeController < ApplicationController
  # Show homepage
  # === Assigns
  # * upcoming_events: instance of UpcomingEvents with default parameters
  # * recent_results: Events with Results within last two weeks
  def index
    @upcoming_events = UpcomingEvents.find_all(:weeks => RacingAssociation.current.weeks_of_upcoming_events)

    cutoff = Date.today - RacingAssociation.current.weeks_of_recent_results * 7
    
    @recent_results = Event.find(:all,
      :select => "DISTINCT(events.id), events.name, events.parent_id, events.date, events.sanctioned_by",
      :joins => [:races => :results],
      :conditions => [
        'events.date > ? and events.sanctioned_by = ?', 
        cutoff, RacingAssociation.current.default_sanctioned_by
      ],
      :order => 'events.date desc'
    )

    @news_category = ArticleCategory.find( :all, :conditions => ["name = 'news'"] )
    @recent_news = Article.find(
      :all,
      :conditions => ['created_at > ? and article_category_id = ?', cutoff, @news_category],
      :order => 'created_at desc'
    )
    
    expires_in 1.hour, :public => true

    render_page
  end
end<commit_msg>Display updated articles in recent news list.<commit_after># Homepage
class HomeController < ApplicationController
  # Show homepage
  # === Assigns
  # * upcoming_events: instance of UpcomingEvents with default parameters
  # * recent_results: Events with Results within last two weeks
  def index
    @upcoming_events = UpcomingEvents.find_all(:weeks => RacingAssociation.current.weeks_of_upcoming_events)

    cutoff = Date.today - RacingAssociation.current.weeks_of_recent_results * 7
    
    @recent_results = Event.find(:all,
      :select => "DISTINCT(events.id), events.name, events.parent_id, events.date, events.sanctioned_by",
      :joins => [:races => :results],
      :conditions => [
        'events.date > ? and events.sanctioned_by = ?', 
        cutoff, RacingAssociation.current.default_sanctioned_by
      ],
      :order => 'events.date desc'
    )

    @news_category = ArticleCategory.find( :all, :conditions => ["name = 'news'"] )
    @recent_news = Article.find(
      :all,
      :conditions => ['(created_at > ? OR updated_at > ?) and article_category_id = ?', cutoff, cutoff, @news_category],
      :order => 'created_at desc'
    )
    
    expires_in 1.hour, :public => true

    render_page
  end
end
{'fraction_non_alphanumeric': 0.11813643926788686, 'fraction_numerical': 0.0016638935108153079, 'mean_word_length': 3.478584729981378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1191785', 'n_tokens_mistral': 762, 'n_tokens_neox': 722, 'n_words': 162}