<commit_before>class Candidate < ActiveRecord::Base
  include DirtyColumns
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks

  belongs_to :person
  has_many :statements
  has_one :campaign
  has_and_belongs_to_many :events

  before_save { |c| c.person_id = nil if c.person_id < 1 }

  attr_reader :person_name

  def person_name
    p = self.person
    p ? "#{p.first_name} #{p.last_name}" : "-- No Name --"
  end
  
  def person_image_url
    p = self.person<commit_msg>fixes nickname handling<commit_after>class Candidate < ActiveRecord::Base
  include DirtyColumns
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks

  belongs_to :person
  has_many :statements
  has_one :campaign
  has_and_belongs_to_many :events

  before_save { |c| c.person_id = nil if c.person_id < 1 }

  attr_reader :person_name

  def person_name
    p = self.person
    p ? "#{!p.nickname.blank? ? p.nickname : p.first_name} #{p.last_name}" : "-- No Name --"
  end
  
  def person_image_url
    p = self.person
{'fraction_non_alphanumeric': 0.09749034749034749, 'fraction_numerical': 0.0019305019305019305, 'mean_word_length': 3.800925925925926, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '2190241', 'n_tokens_mistral': 363, 'n_tokens_neox': 355, 'n_words': 83}