<commit_before>class TagsController < ApplicationController
  
  def index
    @tags = params[:q].blank? ? ActsAsTaggableOn::Tag.all : ActsAsTaggableOn::Tag.all.clone.delete_if{|t| !t.name.downcase.include?(params[:q])}

    respond_to do |format|
      format.js { render :json =>@tags.collect{|t| {:name => t.name} } }
    end
  end
  
  def show
    @events = Event.tagged_with(params[:tagname]).order(:name).to_a
    @single_events = SingleEvent.in_future.tagged_with(params[:tagname]).delete_if {|o| o.occurrence > Date.today + 1.month}
    @events.each do |event|
      future_events = event.single_events.in_future.delete_if {|o| o.occurrence > Date.today + 1.month}
      if !future_events.empty?
        @single_events = @single_events + future_events
        @events.delete(event)
      end
    end
    @single_events = @single_events.sort_by(&:occurrence)
  end

end<commit_msg>where is better than delete after select :)<commit_after>class TagsController < ApplicationController
  
  def index
    @tags = params[:q].blank? ? ActsAsTaggableOn::Tag.all : ActsAsTaggableOn::Tag.all.clone.delete_if{|t| !t.name.downcase.include?(params[:q])}

    respond_to do |format|
      format.js { render :json =>@tags.collect{|t| {:name => t.name} } }
    end
  end
  
  def show
    @events = Event.tagged_with(params[:tagname]).order(:name).to_a
    @single_events = SingleEvent.in_future.tagged_with(params[:tagname]).where("occurrence < ? ", Date.today + 1.month)
    @events.each do |event|
      future_events = event.single_events.in_future.where("occurrence < ? ", Date.today + 1.month)
      if !future_events.empty?
        @single_events = @single_events + future_events
        @events.delete(event)
      end
    end
    @single_events = @single_events.sort_by(&:occurrence)
  end

end
{'fraction_non_alphanumeric': 0.13904338153503892, 'fraction_numerical': 0.002224694104560623, 'mean_word_length': 3.7342105263157896, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '3848429', 'n_tokens_mistral': 634, 'n_tokens_neox': 609, 'n_words': 106}