app/controllers/issues_controller.rb
# recursively percolate/select based on filtering params
recursively percolate/select based on filtering params
recursively percolate / select based on filtering params
def filter(queryset, filter_types)
      selector = filter_types.pop
      return queryset unless selector
      filtered_queryset = queryset.select do |issue|
        case selector
        when 'assignee'
          id = filter_params[selector][:id].to_i
          issue.assignees.map(&:id).include?(id)
        when 'status'
          unless issue.status.nil?
            id = filter_params[selector][:id].to_i
            issue.status.id == id
          end
        when 'discipline'
          unless issue.discipline.nil?
            id = filter_params[selector][:id].to_i
            issue.discipline.id == id
          end
        when 'priority'
          unless issue.priority.nil?
            value = filter_params[selector][:value].to_i
            if filter_params.dig(selector, :type) == 'exact'
              issue.priority.value == value
            else
              issue.priority.value < value.succ
            end
          end
        end
      end
      filter(filtered_queryset, filter_types)
    end
def filter ( queryset , filter_types ) selector = filter_types . pop return queryset unless selector filtered_queryset = queryset . select do | issue | case selector when 'assignee' id = filter_params [ selector ] [ :id ] . to_i issue . assignees . map ( & :id ) . include? ( id ) when 'status' unless issue . status . nil? id = filter_params [ selector ] [ :id ] . to_i issue . status . id == id end when 'discipline' unless issue . discipline . nil? id = filter_params [ selector ] [ :id ] . to_i issue . discipline . id == id end when 'priority' unless issue . priority . nil? value = filter_params [ selector ] [ :value ] . to_i if filter_params . dig ( selector , :type ) == 'exact' issue . priority . value == value else issue . priority . value < value . succ end end end end filter ( filtered_queryset , filter_types ) end
recursively percolate/select based on filtering params
recursively percolate / select based on filtering params
queryset
<not_specific>
filter_types
<not_specific>