<commit_before>module FontAwesomeHelper
  def male(title = '')
    "<i class='fa fa-male blue tip' title='#{title}'></i>".html_safe
  end

  def female(title = '')
    "<i class='fa fa-female pink tip' title='#{title}'></i>".html_safe
  end

  def hitchhiker_gender(gender)
    if gender == 'male'
      male(t('helper.male_hitchhiker'))
    elsif gender == 'female'
      female(t('helper.female_hitchhiker'))
    end
  end

  def passenger_gender(gender)
    if gender == 'male'
      male(t('helper.male_people'))
    elsif gender == 'female'
      female(t('helper.male_people'))
    elsif gender == 'mixed'
      "<span class='tip' title='#{t('helper.mixed_people')}'>
        #{male}
        #{female}
      </span>".html_safe
    end
  end

  def country(country, country_distance=nil)
    country_code = Countries[country]

    if country_distance
      title = "#{country} #{distance( country_distance )}"
    else
      title = country
    end

    flag(country_code, title)
  end

  def country_images_for_user(user)
    array = []; hash = {}
    user.trips.map(&:country_distances).flatten.each do |cd|
      if hash[cd.country]
        hash[cd.country] += cd.distance
      else
        hash[cd.country] =  cd.distance
      end
    end

    hash.each do |country, distance|
      array << country(country, distance)
    end

    array.join(' ').html_safe
  end

  def countries_for_trip(trip)
    array = []
    trip.country_distances.each do |country_distance|
      array << country(country_distance.country, country_distance.distance)
    end
    array.join(' ').html_safe
  end

  def all_country_images
    array = []
    country_distances = CountryDistance.pluck(:country).uniq
    country_distances -= ['unknown', '']
    country_distances.each do |country|
      array << link_to(country(country), "trips/?q%5Bcountry_distances_country_eq%5D=#{country}")
    end
    array.join(' ').html_safe
  end

  def flag(country_code, title = nil)
    country_code = Countries[country_code] if country_code and country_code.length != 2
    return if country_code.blank?
    title = Countries[country_code] if title.nil?
    "<div class='flags-#{country_code.downcase} tip' title='#{title}'></div>".html_safe
  end

  def flag_with_country_name(user)
    return user.location if user.country_code.blank? and user.city.blank?
    return user.city     if user.country_code.blank?
    "#{flag(user.country_code)} <a href='http://maps.google.com.au/?q=#{user.country}+#{user.city}'>#{user.country}, #{user.city}</a>".html_safe
  end

  def waiting_time(time=nil)
    if time.nil?
      "<i class='fa fa-time'></i>".html_safe
    else
      "<i class='fa fa-time tip' title='#{t('helper.waiting_time', time: time)}'></i>".html_safe
    end
  end

  def tags(tag_list)
    tag_list.map{|tag| link_to h(tag.name), trips_path("q[rides_tags_name_eq]" => tag.name), class: 'tag'}.join(' ').html_safe
  end

  def very_good(title = t('helper.very_good_experience'))
    "<span class='tip very-good' title='#{title}'>
      <i class='fa fa-heart'></i>
      <i class='fa fa-smile-o'></i>
    </span>".html_safe
  end
  def good(title = t('helper.good_experience'))
    "<i class='fa fa-smile-o tip' title='#{title}'></i>".html_safe
  end
  def neutral(title = t('helper.neutral_experience'))
    "<i class='fa fa-meh-o tip' title='#{title}'></i>".html_safe
  end
  def bad(title = t('helper.bad_experience'))
    "<i class='fa fa-frown-o tip' title='#{title}'></i>".html_safe
  end
  def very_bad(title = t('helper.very_bad_experience'))
    "<span class='tip' title='#{title}'>
      <i class='fa fa-bolt-o'></i>
      <i class='fa fa-frown-o'></i>
    </span>".html_safe
  end

  def experience(exp)
    if exp == 'good'
      good
    elsif exp == 'very good'
      very_good
    elsif exp == 'neutral'
      neutral
    elsif exp == 'bad'
      bad
    elsif exp == 'very bad'
      very_bad
    end
  end
<commit_msg>adds lightning bolt to very bad experience icon<commit_after>module FontAwesomeHelper
  def male(title = '')
    "<i class='fa fa-male blue tip' title='#{title}'></i>".html_safe
  end

  def female(title = '')
    "<i class='fa fa-female pink tip' title='#{title}'></i>".html_safe
  end

  def hitchhiker_gender(gender)
    if gender == 'male'
      male(t('helper.male_hitchhiker'))
    elsif gender == 'female'
      female(t('helper.female_hitchhiker'))
    end
  end

  def passenger_gender(gender)
    if gender == 'male'
      male(t('helper.male_people'))
    elsif gender == 'female'
      female(t('helper.male_people'))
    elsif gender == 'mixed'
      "<span class='tip' title='#{t('helper.mixed_people')}'>
        #{male}
        #{female}
      </span>".html_safe
    end
  end

  def country(country, country_distance=nil)
    country_code = Countries[country]

    if country_distance
      title = "#{country} #{distance( country_distance )}"
    else
      title = country
    end

    flag(country_code, title)
  end

  def country_images_for_user(user)
    array = []; hash = {}
    user.trips.map(&:country_distances).flatten.each do |cd|
      if hash[cd.country]
        hash[cd.country] += cd.distance
      else
        hash[cd.country] =  cd.distance
      end
    end

    hash.each do |country, distance|
      array << country(country, distance)
    end

    array.join(' ').html_safe
  end

  def countries_for_trip(trip)
    array = []
    trip.country_distances.each do |country_distance|
      array << country(country_distance.country, country_distance.distance)
    end
    array.join(' ').html_safe
  end

  def all_country_images
    array = []
    country_distances = CountryDistance.pluck(:country).uniq
    country_distances -= ['unknown', '']
    country_distances.each do |country|
      array << link_to(country(country), "trips/?q%5Bcountry_distances_country_eq%5D=#{country}")
    end
    array.join(' ').html_safe
  end

  def flag(country_code, title = nil)
    country_code = Countries[country_code] if country_code and country_code.length != 2
    return if country_code.blank?
    title = Countries[country_code] if title.nil?
    "<div class='flags-#{country_code.downcase} tip' title='#{title}'></div>".html_safe
  end

  def flag_with_country_name(user)
    return user.location if user.country_code.blank? and user.city.blank?
    return user.city     if user.country_code.blank?
    "#{flag(user.country_code)} <a href='http://maps.google.com.au/?q=#{user.country}+#{user.city}'>#{user.country}, #{user.city}</a>".html_safe
  end

  def waiting_time(time=nil)
    if time.nil?
      "<i class='fa fa-time'></i>".html_safe
    else
      "<i class='fa fa-time tip' title='#{t('helper.waiting_time', time: time)}'></i>".html_safe
    end
  end

  def tags(tag_list)
    tag_list.map{|tag| link_to h(tag.name), trips_path("q[rides_tags_name_eq]" => tag.name), class: 'tag'}.join(' ').html_safe
  end

  def very_good(title = t('helper.very_good_experience'))
    "<span class='tip very-good' title='#{title}'>
      <i class='fa fa-heart'></i>
      <i class='fa fa-smile-o'></i>
    </span>".html_safe
  end
  def good(title = t('helper.good_experience'))
    "<i class='fa fa-smile-o tip' title='#{title}'></i>".html_safe
  end
  def neutral(title = t('helper.neutral_experience'))
    "<i class='fa fa-meh-o tip' title='#{title}'></i>".html_safe
  end
  def bad(title = t('helper.bad_experience'))
    "<i class='fa fa-frown-o tip' title='#{title}'></i>".html_safe
  end
  def very_bad(title = t('helper.very_bad_experience'))
    "<span class='tip' title='#{title}'>
      <i class='fa fa-bolt'></i>
      <i class='fa fa-frown-o'></i>
    </span>".html_safe
  end

  def experience(exp)
    if exp == 'good'
      good
    elsif exp == 'very good'
      very_good
    elsif exp == 'neutral'
      neutral
    elsif exp == 'bad'
      bad
    elsif exp == 'very bad'
      very_bad
    end
  end

{'fraction_non_alphanumeric': 0.1588773177546355, 'fraction_numerical': 0.000762001524003048, 'mean_word_length': 3.236148466917698, 'pattern_counts': {'":': 0, '<': 79, '<?xml version=': 0, '>': 69, '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': '4918731', 'n_tokens_mistral': 2765, 'n_tokens_neox': 2750, 'n_words': 563}