<commit_before>Spree::Variant.class_eval do
  attr_accessible :is_in_usd, :unconverted_price, :certificate_number
  
  has_one :diamond_certification

  has_many :variant_properties, :dependent => :destroy
  has_many :properties, :through => :variant_properties
  
  def normal_price
    convert_price self[:price]
  end  
  def sale_price
    convert_price product.sale_price
  end
  
  def currently_on_sale?
    product.currently_on_sale?
  end
  def price
    currently_on_sale? ? sale_price : normal_price
  end
  
  def in_usd?
    !!self[:is_in_usd]
  end
  
  def unconverted_price=(unconverted)
    self.price = unconverted
  end
  def unconverted_price
    self[:price]
  end
  
  def set_property(property_name, property_value)
    ActiveRecord::Base.transaction do<commit_msg>fixed null reference error preventing new products being created<commit_after>Spree::Variant.class_eval do
  attr_accessible :is_in_usd, :unconverted_price, :certificate_number
  
  has_one :diamond_certification

  has_many :variant_properties, :dependent => :destroy
  has_many :properties, :through => :variant_properties
  
  def normal_price
    convert_price self[:price]
  end  
  def sale_price
    convert_price product.sale_price
  end
  
  def currently_on_sale?
    product ? product.currently_on_sale? : false
  end
  def price
    currently_on_sale? ? sale_price : normal_price
  end
  
  def in_usd?
    !!self[:is_in_usd]
  end
  
  def unconverted_price=(unconverted)
    self.price = unconverted
  end
  def unconverted_price
    self[:price]
  end
  
  def set_property(property_name, property_value)
    ActiveRecord::Base.transaction do
{'fraction_non_alphanumeric': 0.0668693009118541, 'fraction_numerical': 0.0, 'mean_word_length': 4.127725856697819, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6629952', 'n_tokens_mistral': 563, 'n_tokens_neox': 538, 'n_words': 117}