<commit_before>class CurationDashboardController < ApplicationController
  actions_without_auth :open_flags, :evidence_items_requiring_action, :entities_with_outstanding_revisions

  def open_flags
    flags = Flag.index_scope
              .where(state: 'open')
              .order('flags.id asc')
              .page(params[:page].to_i)
              .per(params[:count].to_i)
              .uniq

    render json: PaginatedCollectionPresenter.new(
      flags,
      request,
      FlagPresenter,
      PaginationPresenter
    )
  end

  def evidence_items_requiring_action
    eids = EvidenceItem.index_scope
            .where(status: 'submitted')
            .order('evidence_items.id asc')
            .page(params[:page].to_i)
            .per(params[:count].to_i)

    render json: PaginatedCollectionPresenter.new(
      eids,
      request,
      EvidenceItemIndexPresenter,<commit_msg>All sorting on the open_flag endpoint<commit_after>class CurationDashboardController < ApplicationController
  include WithSorting

  actions_without_auth :open_flags, :evidence_items_requiring_action, :entities_with_outstanding_revisions

  def open_flags
    flags = Flag.index_scope
              .where(state: 'open')
              .order("flags.created_at #{sort_direction('created_at')}")
              .page(params[:page].to_i)
              .per(params[:count].to_i)
              .uniq

    render json: PaginatedCollectionPresenter.new(
      flags,
      request,
      FlagPresenter,
      PaginationPresenter
    )
  end

  def evidence_items_requiring_action
    eids = EvidenceItem.index_scope
            .where(status: 'submitted')
            .order('evidence_items.id asc')
            .page(params[:page].to_i)
            .per(params[:count].to_i)

    render json: PaginatedCollectionPresenter.new(
      eids,
      request,
      EvidenceItemIndexPresenter,
{'fraction_non_alphanumeric': 0.08781266631186802, 'fraction_numerical': 0.0, 'mean_word_length': 2.5946462715105163, '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': '521921', 'n_tokens_mistral': 560, 'n_tokens_neox': 540, 'n_words': 90}