<commit_before>class ClientGroup
  include DataMapper::Resource
  
  property :id,                Serial
  property :name,              String, :nullable => false
  property :number_of_members, Integer, :nullable => true, :min => 1, :max => 20, :default => 5
  property :code,              String, :length => 14, :nullable => false, :index => true

  validates_is_unique   :code
  validates_length      :code, :min => 1, :max => 14

  has n, :clients
  belongs_to :center
  validates_is_unique :name, :scope => :center_id  

  def self.search(q)
    if /^\d+$/.match(q)
      all(:conditions => ["id = ? or code=?", q, q])
    else
      all(:conditions => ["code=? or name like ?", q, q+'%'])
    end
  end
  

end
<commit_msg>Scope of code changed from global to center based<commit_after>class ClientGroup
  include DataMapper::Resource
  
  property :id,                Serial
  property :name,              String, :nullable => false
  property :number_of_members, Integer, :nullable => true, :min => 1, :max => 20, :default => 5
  property :code,              String, :length => 14, :nullable => false, :index => true

  validates_is_unique   :code, :scope => :center_id
  validates_length      :code, :min => 1, :max => 14

  has n, :clients
  belongs_to :center
  validates_is_unique :name, :scope => :center_id  

  def self.search(q)
    if /^\d+$/.match(q)
      all(:conditions => ["id = ? or code=?", q, q])
    else
      all(:conditions => ["code=? or name like ?", q, q+'%'])
    end
  end
  

end

{'fraction_non_alphanumeric': 0.14729194187582562, 'fraction_numerical': 0.011889035667107, 'mean_word_length': 2.6951219512195124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 30, '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': '3484656', 'n_tokens_mistral': 515, 'n_tokens_neox': 494, 'n_words': 150}