<commit_before>class ProjectsController < ApplicationController
  include SampleActions
  include RenamingUtil
  include TeamsHelper
  include InputSanitizeHelper

  before_action :load_vars, only: %i(show edit update
                                     notifications reports
                                     samples experiment_archive
                                     delete_samples samples_index)
  before_action :load_projects_tree, only: %i(sidebar show samples archive
                                              experiment_archive)
  before_action :check_view_permissions, only: %i(show reports notifications
                                                  samples experiment_archive
                                                  samples_index)
  before_action :check_create_permissions, only: %i(new create)
  before_action :check_manage_permissions, only: :edit
  before_action :set_inline_name_editing, only: %i(show experiment_archive)

  # except parameter could be used but it is not working.
  layout 'fluid'

  # Action defined in SampleActions
  DELETE_SAMPLES = 'Delete'.freeze

  def index
    respond_to do |format|
      format.json do
        @current_team = current_team if current_team
        @current_team ||= current_user.teams.first
        @projects = ProjectsOverviewService
                    .new(@current_team, current_user, params)
                    .project_cards
        render json: {
          html: render_to_string(
            partial: 'projects/index/team_projects.html.erb',
                     locals: { projects: @projects }
          ),
          count: @projects.size
        }
      end
      format.html do
        current_team_switch(Team.find_by_id(params[:team])) if params[:team]
        @teams = current_user.teams
        # New project for create new project modal
        @project = Project.new
        if current_team
          view_state =
            current_team.current_view_state(current_user)
          @current_filter = view_state.state.dig('projects', 'filter')
          @current_sort = view_state.state.dig('projects', 'cards', 'sort')
        end
        load_projects_tree
      end
    end
  end

  def index_dt
    @draw = params[:draw].to_i
    respond_to do |format|
      format.json do
        @current_team = current_team if current_team
        @current_team ||= current_user.teams.first
        @projects = ProjectsOverviewService
                    .new(@current_team, current_user, params)
                    .projects_datatable
      end
    end
  end

  def sidebar
    respond_to do |format|
      format.json do
        render json: {
          html: render_to_string(
            partial: 'shared/sidebar/projects.html.erb',
            formats: :html
          )
        }
      end
    end
  end

  def archive
    index
  end
<commit_msg>Remove archive controller action<commit_after>class ProjectsController < ApplicationController
  include SampleActions
  include RenamingUtil
  include TeamsHelper
  include InputSanitizeHelper

  before_action :load_vars, only: %i(show edit update
                                     notifications reports
                                     samples experiment_archive
                                     delete_samples samples_index)
  before_action :load_projects_tree, only: %i(sidebar show samples archive
                                              experiment_archive)
  before_action :check_view_permissions, only: %i(show reports notifications
                                                  samples experiment_archive
                                                  samples_index)
  before_action :check_create_permissions, only: %i(new create)
  before_action :check_manage_permissions, only: :edit
  before_action :set_inline_name_editing, only: %i(show experiment_archive)

  # except parameter could be used but it is not working.
  layout 'fluid'

  # Action defined in SampleActions
  DELETE_SAMPLES = 'Delete'.freeze

  def index
    respond_to do |format|
      format.json do
        @current_team = current_team if current_team
        @current_team ||= current_user.teams.first
        @projects = ProjectsOverviewService
                    .new(@current_team, current_user, params)
                    .project_cards
        render json: {
          html: render_to_string(
            partial: 'projects/index/team_projects.html.erb',
                     locals: { projects: @projects }
          ),
          count: @projects.size
        }
      end
      format.html do
        current_team_switch(Team.find_by_id(params[:team])) if params[:team]
        @teams = current_user.teams
        # New project for create new project modal
        @project = Project.new
        if current_team
          view_state =
            current_team.current_view_state(current_user)
          @current_filter = view_state.state.dig('projects', 'filter')
          @current_sort = view_state.state.dig('projects', 'cards', 'sort')
        end
        load_projects_tree
      end
    end
  end

  def index_dt
    @draw = params[:draw].to_i
    respond_to do |format|
      format.json do
        @current_team = current_team if current_team
        @current_team ||= current_user.teams.first
        @projects = ProjectsOverviewService
                    .new(@current_team, current_user, params)
                    .projects_datatable
      end
    end
  end

  def sidebar
    respond_to do |format|
      format.json do
        render json: {
          html: render_to_string(
            partial: 'shared/sidebar/projects.html.erb',
            formats: :html
          )
        }
      end
    end
  end

{'fraction_non_alphanumeric': 0.06441393875395987, 'fraction_numerical': 0.0, 'mean_word_length': 1.880385200202737, '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': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2873232', 'n_tokens_mistral': 1471, 'n_tokens_neox': 1427, 'n_words': 361}