<commit_before>class Power < ActiveRecord::Base
  belongs_to :character
  has_many :power_weapons
  has_many :power_attributes

  ORDERED = ['At-Will', 'Encounter', 'Daily']

  # Returns a case statement for ordering by a particular set of strings
  # Note that the SQL is built by hand and therefore injection is possible,
  # however since we're declaring the priorities in a constant above it's
  # safe.
  def self.order_by_case
    ret = "CASE"
    ORDERED.each_with_index do |p, i|
      ret << " WHEN power_usage = '#{p}' THEN #{i}"
    end
    ret << " END"
  end

  default_scope {
    order(order_by_case).order(:name).
    includes([:power_weapons, :power_attributes])
  }

  def attack_type
    a = read_attribute(:attack_type)
    if a.present?
      a.titleize.sub("Area Burst", "AB").sub(" Squares", "")
    else
      " "
    end
  end

  def full_attack_type
    read_attribute(:attack_type)
  end

  def action_type_symbol
    case action_type.titleize
    when "Standard Action"
      "fa-star"
    when "Movement Action"
      "fa-star-half-o"
    when "Minor Action"
      "fa-sun-o"
    when "Free Action"
      "fa-star-o"
    when "Immediate Interrupt"
      "fa-fighter-jet"
    when "Immediate Reaction"
      "fa-fighter-jet"
    else
      ""
    end
  end
end
<commit_msg>Fixed and changed move action icon<commit_after>class Power < ActiveRecord::Base
  belongs_to :character
  has_many :power_weapons
  has_many :power_attributes

  ORDERED = ['At-Will', 'Encounter', 'Daily']

  # Returns a case statement for ordering by a particular set of strings
  # Note that the SQL is built by hand and therefore injection is possible,
  # however since we're declaring the priorities in a constant above it's
  # safe.
  def self.order_by_case
    ret = "CASE"
    ORDERED.each_with_index do |p, i|
      ret << " WHEN power_usage = '#{p}' THEN #{i}"
    end
    ret << " END"
  end

  default_scope {
    order(order_by_case).order(:name).
    includes([:power_weapons, :power_attributes])
  }

  def attack_type
    a = read_attribute(:attack_type)
    if a.present?
      a.titleize.sub("Area Burst", "AB").sub(" Squares", "")
    else
      " "
    end
  end

  def full_attack_type
    read_attribute(:attack_type)
  end

  def action_type_symbol
    case action_type.titleize
    when "Standard Action"
      "fa-star"
    when "Move Action"
      "fa-arrows"
    when "Minor Action"
      "fa-sun-o"
    when "Free Action"
      "fa-star-o"
    when "Immediate Interrupt"
      "fa-fighter-jet"
    when "Immediate Reaction"
      "fa-fighter-jet"
    else
      ""
    end
  end
end

{'fraction_non_alphanumeric': 0.10405508798775823, 'fraction_numerical': 0.0, 'mean_word_length': 2.7680115273775217, 'pattern_counts': {'":': 0, '<': 13, '<?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': '2313904', 'n_tokens_mistral': 906, 'n_tokens_neox': 858, 'n_words': 247}