<commit_before>class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable

  has_many :shipments
  
  has_many :subscriptions do
    def active
      where(cancelled_at: nil).first
    end
  end
  has_many :payments, through: :subscriptions

  before_destroy :cancel_subscription!

  validates :name            , :presence => true
  validates :address_street  , :presence => true
  validates :address_locality, :presence => true
  validates :address_region  , :presence => true
  validates :address_postcode, :presence => true

  def paid_for?(pod)
    # Need some logic here around whether a user has paid for a particular pod
    # This will test the date of their last payment against the date of the pod,
    # most likely
    payments.where(pod: pod, state: "paid").present?
  end
  
  def recently_signed_up?
    subscriptions.active && subscriptions.active.awaiting_first_payment?
  end<commit_msg>region is no longer required<commit_after>class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable

  has_many :shipments
  
  has_many :subscriptions do
    def active
      where(cancelled_at: nil).first
    end
  end
  has_many :payments, through: :subscriptions

  before_destroy :cancel_subscription!

  validates :name            , :presence => true
  validates :address_street  , :presence => true
  validates :address_locality, :presence => true
  #validates :address_region  , :presence => true
  validates :address_postcode, :presence => true

  def paid_for?(pod)
    # Need some logic here around whether a user has paid for a particular pod
    # This will test the date of their last payment against the date of the pod,
    # most likely
    payments.where(pod: pod, state: "paid").present?
  end
  
  def recently_signed_up?
    subscriptions.active && subscriptions.active.awaiting_first_payment?
  end
{'fraction_non_alphanumeric': 0.07984293193717278, 'fraction_numerical': 0.0, 'mean_word_length': 3.9956427015250546, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1731076', 'n_tokens_mistral': 686, 'n_tokens_neox': 671, 'n_words': 209}