<commit_before>class AwesomeTranslations::HandlersController < AwesomeTranslations::ApplicationController
  before_action :set_handler, only: [:show, :update_groups_cache]

  def index
    @handlers = AwesomeTranslations::CacheDatabaseGenerator::Handler.order(:name)
  end

  def update_cache
    generator = AwesomeTranslations::CacheDatabaseGenerator.current
    generator.update_handlers

    redirect_to :handlers
  end

  def update_groups_cache
    generator = AwesomeTranslations::CacheDatabaseGenerator.current
    generator.update_handlers do |handler_model|
      next unless handler_model.identifier == @handler.identifier
      generator.update_groups_for_handler(handler_model)
    end

    redirect_to @handler
  end

  def show
    if params[:q]
      @ransack_values = params[:q]
    else
      @ransack_values = {
        with_translations: "only_with"
      }
    end

    @groups = @handler
      .groups
      .ransack(@ransack_values)
      .result
      .includes(handler_translations: :translation_key)
      .order(:name)

    puts "SQL: #{@groups.to_sql}"

    case @ransack_values[:with_translations]
    when "only_with"
      @groups = @groups.select { |group| group.handler_translations.any? }
    when "only_without"
      @groups = @groups.select { |group| group.handler_translations.empty? }
    end
  end<commit_msg>Removed debug output<commit_after>class AwesomeTranslations::HandlersController < AwesomeTranslations::ApplicationController
  before_action :set_handler, only: [:show, :update_groups_cache]

  def index
    @handlers = AwesomeTranslations::CacheDatabaseGenerator::Handler.order(:name)
  end

  def update_cache
    generator = AwesomeTranslations::CacheDatabaseGenerator.current
    generator.update_handlers

    redirect_to :handlers
  end

  def update_groups_cache
    generator = AwesomeTranslations::CacheDatabaseGenerator.current
    generator.update_handlers do |handler_model|
      next unless handler_model.identifier == @handler.identifier
      generator.update_groups_for_handler(handler_model)
    end

    redirect_to @handler
  end

  def show
    if params[:q]
      @ransack_values = params[:q]
    else
      @ransack_values = {
        with_translations: "only_with"
      }
    end

    @groups = @handler
      .groups
      .ransack(@ransack_values)
      .result
      .includes(handler_translations: :translation_key)
      .order(:name)

    case @ransack_values[:with_translations]
    when "only_with"
      @groups = @groups.select { |group| group.handler_translations.any? }
    when "only_without"
      @groups = @groups.select { |group| group.handler_translations.empty? }
    end
  end
{'fraction_non_alphanumeric': 0.08614232209737828, 'fraction_numerical': 0.0, 'mean_word_length': 3.7358156028368796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3832350', 'n_tokens_mistral': 809, 'n_tokens_neox': 772, 'n_words': 148}