<commit_before>class Plan < ActiveRecord::Base
  attr_accessible :name, :postcode, :public_guid, :private_guid, :opt_out, :plan_id

  validates_uniqueness_of :private_guid
  validates_uniqueness_of :public_guid, unless: Proc.new { |p| p.public_guid == nil || p.public_guid.empty? }

  has_many :people

  # manage the self-referential nature of plans
  has_many   :child_plans, :class_name => "Plan", :foreign_key => "plan_id"
  belongs_to :parent_plan, :class_name => "Plan", :foreign_key => "plan_id"

  before_create :init_guids

  # using *_plan names for these so as not to clash with existing AR methods
  scope :public_plans,  -> { where( "public_guid is not null and public_guid <> ''" ) }
  scope :private_plans, -> { where( :public_guid => [nil, ''] ) } # a way to get to a working OR clause

  scope :top_level,     -> { where(plan_id: nil) }
  scope :for_postcode,  ->(postcode) { where(postcode: postcode) }

  def opt_out
    @opt_out
  end

  def opt_out= transient_check_box_flag
    @opt_out = transient_check_box_flag
  end

  def display_name
    if public?
      self.name
    else
      '[details-withheld]'
    end
  end<commit_msg>private plan display name change<commit_after>class Plan < ActiveRecord::Base
  attr_accessible :name, :postcode, :public_guid, :private_guid, :opt_out, :plan_id

  validates_uniqueness_of :private_guid
  validates_uniqueness_of :public_guid, unless: Proc.new { |p| p.public_guid == nil || p.public_guid.empty? }

  has_many :people

  # manage the self-referential nature of plans
  has_many   :child_plans, :class_name => "Plan", :foreign_key => "plan_id"
  belongs_to :parent_plan, :class_name => "Plan", :foreign_key => "plan_id"

  before_create :init_guids

  # using *_plan names for these so as not to clash with existing AR methods
  scope :public_plans,  -> { where( "public_guid is not null and public_guid <> ''" ) }
  scope :private_plans, -> { where( :public_guid => [nil, ''] ) } # a way to get to a working OR clause

  scope :top_level,     -> { where(plan_id: nil) }
  scope :for_postcode,  ->(postcode) { where(postcode: postcode) }

  def opt_out
    @opt_out
  end

  def opt_out= transient_check_box_flag
    @opt_out = transient_check_box_flag
  end

  def display_name
    if public?
      self.name
    else
      '(details withheld)'
    end
  end
{'fraction_non_alphanumeric': 0.1095831542758917, 'fraction_numerical': 0.0, 'mean_word_length': 3.9217758985200843, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '762356', 'n_tokens_mistral': 832, 'n_tokens_neox': 795, 'n_words': 218}