<commit_before>module Admin::DocumentsHelper
  def nested_attribute_destroy_checkbox_options(form)
    checked_value, unchecked_value = '0', '1'
    checked = form.object[:_destroy].present? ? (form.object[:_destroy] == checked_value) : form.object.persisted?
    [{ checked: checked }, checked_value, unchecked_value]
  end

  def link_to_filter(link, options)
    link_to link, url_for(params.slice('filter', 'author').merge(options)), class: filter_class(options)
  end

  def filter_class(options)
    current = options.keys.all? do |key|
      options[key].to_param == params[key].to_param
    end

    'current' if current
  end
end<commit_msg>Filter links should also remember the current organisation<commit_after>module Admin::DocumentsHelper
  def nested_attribute_destroy_checkbox_options(form)
    checked_value, unchecked_value = '0', '1'
    checked = form.object[:_destroy].present? ? (form.object[:_destroy] == checked_value) : form.object.persisted?
    [{ checked: checked }, checked_value, unchecked_value]
  end

  def link_to_filter(link, options)
    link_to link, url_for(params.slice('filter', 'author', 'organisation').merge(options)), class: filter_class(options)
  end

  def filter_class(options)
    current = options.keys.all? do |key|
      options[key].to_param == params[key].to_param
    end

    'current' if current
  end
end
{'fraction_non_alphanumeric': 0.11976487876561352, 'fraction_numerical': 0.0029390154298310064, 'mean_word_length': 4.9475982532751095, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5547544', 'n_tokens_mistral': 424, 'n_tokens_neox': 415, 'n_words': 91}