<commit_before>module EmailsHelper
  # Mapping from status strings to bootstrap classes
  # The naming of the classes is not entirely consistent. There are two variants
  def bootstrap_status_mapping(variant = false)
    map = {
      "delivered" => "success",
      "soft_bounce" => "warning",
      "unknown" => nil
    }
    map["hard_bounce"] = variant ? "important" : "error"
    map
  end

  def bootstrap_status_class(status, variant = false)
    raise "Unknown status" unless bootstrap_status_mapping(variant).has_key?(status)
    bootstrap_status_mapping(variant)[status]
  end

  # Give a warning level (used for colouring things in Bootstrap) based on whether the email has
  # been delivered succesfully
  def row_status_class(status)
    bootstrap_status_class(status)
  end

  def status_class_category(status)
    bootstrap_status_class(status, true)
  end

  def label_class(status)
    ["label", ("label-#{status_class_category(status)}" if status_class_category(status))]
  end

  def status_name(status)
    case status
    when "delivered"
      "Delivered"
    when "soft_bounce"
      "Soft bounce"<commit_msg>Inline method<commit_after>module EmailsHelper
  # Mapping from status strings to bootstrap classes
  # The naming of the bootstrap classes is not entirely consistent. There are two variants
  def bootstrap_status_class(status, variant = false)
    map = {
      "delivered" => "success",
      "soft_bounce" => "warning",
      "unknown" => nil
    }
    map["hard_bounce"] = variant ? "important" : "error"

    raise "Unknown status" unless map.has_key?(status)
    map[status]
  end

  # Give a warning level (used for colouring things in Bootstrap) based on whether the email has
  # been delivered succesfully
  def row_status_class(status)
    bootstrap_status_class(status)
  end

  def status_class_category(status)
    bootstrap_status_class(status, true)
  end

  def label_class(status)
    ["label", ("label-#{status_class_category(status)}" if status_class_category(status))]
  end

  def status_name(status)
    case status
    when "delivered"
      "Delivered"
    when "soft_bounce"
      "Soft bounce"
{'fraction_non_alphanumeric': 0.0887546468401487, 'fraction_numerical': 0.0, 'mean_word_length': 3.9043280182232345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7560775', 'n_tokens_mistral': 664, 'n_tokens_neox': 632, 'n_words': 186}