app/controllers/projects_controller.rb
# Retrieve project data using the various query parameters.
# The parameters determine what to select *and* fields to load
# rubocop:disable Metrics/PerceivedComplexity
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
# rubocop:disable Metrics/MethodLength
Retrieve project data using the various query parameters.
The parameters determine what to select *and* fields to load
rubocop:disable Metrics/PerceivedComplexity
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
rubocop:disable Metrics/MethodLength
Retrieve project data using the various query parameters . The parameters determine what to select * and * fields to load rubocop : disable Metrics / PerceivedComplexity rubocop : disable Metrics / AbcSize Metrics / CyclomaticComplexity rubocop : disable Metrics / MethodLength
def retrieve_projects
    @projects = Project.all
    @projects = @projects.public_send params[:status] if
       %w[in_progress passing].include? params[:status]
    @projects = @projects.gteq(params[:gteq]) if params[:gteq].present?
    @projects = @projects.lteq(params[:lteq]) if params[:lteq].present?
    @projects = @projects.text_search(params[:pq]) if params[:pq].present?
    @projects = @projects.url_search(params[:url]) if params[:url].present?
    @projects = @projects.search_for(params[:q]) if params[:q].present?
    if params[:ids].present?
      @projects = @projects.where(
        'id in (?)', params[:ids].split(',').map { |x| Integer(x) }
      )
    end
    @projects
  end
def retrieve_projects @projects = Project . all @projects = @projects . public_send params [ :status ] if %w[ in_progress passing ] . include? params [ :status ] @projects = @projects . gteq ( params [ :gteq ] ) if params [ :gteq ] . present? @projects = @projects . lteq ( params [ :lteq ] ) if params [ :lteq ] . present? @projects = @projects . text_search ( params [ :pq ] ) if params [ :pq ] . present? @projects = @projects . url_search ( params [ :url ] ) if params [ :url ] . present? @projects = @projects . search_for ( params [ :q ] ) if params [ :q ] . present? if params [ :ids ] . present? @projects = @projects . where ( 'id in (?)' , params [ :ids ] . split ( ',' ) . map { | x | Integer ( x ) } ) end @projects end
Retrieve project data using the various query parameters.
Retrieve project data using the various query parameters .
# We had to keep this line the same to satisfy brakeman # "Prefix query" - query against *prefix* of a URL or name # "url query" - query for a URL match (home page or repo) # "Normal query" - text search against URL, name, and description # This will NOT match full URLs, but will match partial URLs.