Skip to content

Correct name of sorting

Anna Kalandadze requested to merge 635-sort_projects_by_date_approved into development

Closes #635 (closed) This already was fixed:

    def apply_ordering
      # For searches, indicate order -1
      if params[:query].present?
        @order = '-1'
        return
      end

      @order = params[:order] || '0'
      case @order
      when '0' # Newest on top
        @possible_projects = @possible_projects.order(approved_at: :desc)
      when '1' # Alphabetical
        @possible_projects = @possible_projects.order(Project.arel_table['name'].lower.asc)
      when '2' # Group by offerer
        ids = @possible_projects.sort_by { |x| x.offerer.name }.map(&:id)
        @possible_projects = Project.find_ordered(ids)
      end
    end

I added new clear name.

Merge request reports

Loading