<commit_before>class AjaxHandlerController < ApplicationController

  def search_issues
    issues=""
    year=params[:year]
    month=params[:month]
    month="0"+month.to_s if month.to_i < 10
    search_issues = Issue.search_issues(year,month,true)
    search_issues.each do |search_issue|
      issues += '<a href="/issue/'+search_issue.number.to_s+'">'+search_issue.number.to_s+'</a>'
    end
    render :text => issues
  end

  def admin_search_issues
    issues=""
    year=params[:year]
    month=params[:month]
    month="0"+month.to_s if month.to_i < 10
    search_issues = Issue.search_issues(year,month,false)
    search_issues.each do |search_issue|
      issues += '<a class="issue_link" href="/admin/ordering/priority?issue_id='+search_issue.id.to_s+'">'+search_issue.number.to_s+'</a>'
    end
    render :text => issues
  end

end<commit_msg>Dry ajax_handler_controller<commit_after>class AjaxHandlerController < ApplicationController

  def search_issues
    issues_links = fetch_issues do |issue|
      view_context.link_to issue.number, home_issue_path(issue.number)
    end

    render text: issues_links.join
  end

  def admin_search_issues
    issues_links = fetch_issues(published: false) do |issue|
      view_context.link_to issue.number, priority_admin_orderings_path(issue_id: issue.id),
                           class: 'issue_link'
    end

    render text: issues_links.join
  end

  private

  def fetch_issues(options = {})
    published = options.fetch(:published) { true }
    year = params.fetch(:year) { Date.today.year.to_s }
    month = params.fetch(:month) { Date.today.month.to_s }.rjust(2, '0')

    Issue.search_issues(year, month, published).map { |issue| yield(issue) }
  end
end
{'fraction_non_alphanumeric': 0.11942028985507247, 'fraction_numerical': 0.00463768115942029, 'mean_word_length': 3.8077994428969357, 'pattern_counts': {'":': 0, '<': 11, '<?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': '1202951', 'n_tokens_mistral': 571, 'n_tokens_neox': 554, 'n_words': 105}