<commit_before>class Admin::IssuesController < AdminController
  before_filter :ensure_editable, except: :index
  before_filter :fetch_issue, only: [:edit, :update, :destroy, :votes_search]

  helper_method :edit_steps

  def index
    @issues_by_status = Issue.order(:title).group_by { |e| e.status }

    respond_to do |format|
      format.html
      format.json { render json: @issues_by_status.values.flatten }
    end
  end

  def new
    @issue = Issue.new
    fetch_categories

    edit_steps.first!

    respond_to do |format|
      format.html<commit_msg>Optimize DB calls in admin/issues#index.<commit_after>class Admin::IssuesController < AdminController
  before_filter :ensure_editable, except: :index
  before_filter :fetch_issue, only: [:edit, :update, :destroy, :votes_search]

  helper_method :edit_steps

  def index
    issues = Issue.order(:title).includes(:topics, :editor, :last_updated_by)
    @issues_by_status = issues.group_by { |e| e.status }

    respond_to do |format|
      format.html
      format.json { render json: @issues_by_status.values.flatten }
    end
  end

  def new
    @issue = Issue.new
    fetch_categories

    edit_steps.first!

    respond_to do |format|
      format.html
{'fraction_non_alphanumeric': 0.09656301145662848, 'fraction_numerical': 0.0, 'mean_word_length': 3.685823754789272, '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': '2222939', 'n_tokens_mistral': 402, 'n_tokens_neox': 388, 'n_words': 91}