<commit_before>class Brick < ActiveRecord::Base
  has_random_key :url_key, :size => 4
  validates_uniqueness_of :url_key
  
  validates_presence_of :first_name, :last_name
  validate :valid_email?
  
  validate do |b|
    b.errors.add(:value_in_pounds, "The minimum donation is £2.50") if b.value < 250
    b.errors.add(:value_in_pounds, "The maximum donation is £500. Please contact us directly at <EMAIL> if you wish to donate more.") if b.value > 500_00
  end
  
  attr_accessor :billing_surname, :billing_firstnames, :billing_address1, :billing_address2, 
    :billing_city, :billing_post_code, :billing_country
  # validates_presence_of :billing_surname, :billing_firstname, :billing_address1, :billing_city, :billing_post_code, :on => :create
  
  def initialize(attributes = nil)
    super
    self.icon_id ||= 1
  end
  
  def before_save
    case value
      when 0..9_99 then self.colour = 'a'
      when 10_00..19_99 then self.colour = 'b'
      when 20_00..49_99 then self.colour ||= ['c1', 'c2', 'c3', 'c4'].rand
      when 50_00..500_00 then self.colour = 'd'
    end
  end
  
  def can_set_colour?
    (value >= 20_00 and value < 49_99)
  end
  <commit_msg>Fixed bug in colour picker<commit_after>class Brick < ActiveRecord::Base
  has_random_key :url_key, :size => 4
  validates_uniqueness_of :url_key
  
  validates_presence_of :first_name, :last_name
  validate :valid_email?
  
  validate do |b|
    b.errors.add(:value_in_pounds, "The minimum donation is £2.50") if b.value < 250
    b.errors.add(:value_in_pounds, "The maximum donation is £500. Please contact us directly at <EMAIL> if you wish to donate more.") if b.value > 500_00
  end
  
  attr_accessor :billing_surname, :billing_firstnames, :billing_address1, :billing_address2, 
    :billing_city, :billing_post_code, :billing_country
  # validates_presence_of :billing_surname, :billing_firstname, :billing_address1, :billing_city, :billing_post_code, :on => :create
  
  def initialize(attributes = nil)
    super
    self.icon_id ||= 1
  end
  
  def before_save
    case value
      when 0..9_99 then self.colour = 'a'
      when 10_00..19_99 then self.colour = 'b'
      when 20_00..49_99 then self.colour ||= ['c1', 'c2', 'c3', 'c4'].rand
      when 50_00..500_00 then self.colour = 'd'
    end
  end
  
  def can_set_colour?
    (value and value >= 20_00 and value < 49_99)
  end
  
{'fraction_non_alphanumeric': 0.10561892691170258, 'fraction_numerical': 0.050697084917617236, 'mean_word_length': 3.670611439842209, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '4366494', 'n_tokens_mistral': 966, 'n_tokens_neox': 871, 'n_words': 222}