Sha256: 5deef787923481cbd9c3b1c70ccec1a80dc146b5ec233ea2d42c473788a9bfe2

Contents?: true

Size: 758 Bytes

Versions: 17

Compression:

Stored size: 758 Bytes

Contents

format do
  # all filter keys in the order they were selected
  def all_filter_keys
    @all_filter_keys ||= filter_keys_from_params | filter_keys
  end

  def filter_and_sort_cql
    filter_cql.merge sort_cql
  end

  def filter_cql
    return {} if filter_hash.empty?

    filter_cql_from_params
  end

  # separate method is needed for tests
  def filter_cql_from_params
    filter_class.new(filter_keys_with_values, blocked_id_cql).to_cql
  end

  def sort_cql
    { sort: current_sort }
  end

  def blocked_id_cql
    not_ids = filter_param :not_ids
    not_ids.present? ? { id: ["not in", not_ids.split(",")] } : {}
  end

  def current_sort
    sort_param || default_sort_option
  end

  def default_sort_option
    card.cql_content[:sort]
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
card-mod-search-0.14.2 set/abstract/03_filter/query_construction.rb
card-mod-search-0.14.1 set/abstract/03_filter/query_construction.rb
card-mod-search-0.14.0 set/abstract/03_filter/query_construction.rb
card-mod-search-0.13.4 set/abstract/03_filter/query_construction.rb
card-mod-search-0.13.3 set/abstract/03_filter/query_construction.rb
card-mod-search-0.13.2 set/abstract/03_filter/query_construction.rb
card-mod-search-0.13.1 set/abstract/03_filter/query_construction.rb
card-mod-search-0.13.0 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.7 set/abstract/03_filter/query_construction.rb
card-mod-search-0.12.0 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.6 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.5 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.4 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.3 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.2 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.1 set/abstract/03_filter/query_construction.rb
card-mod-search-0.11.0 set/abstract/03_filter/query_construction.rb