<commit_before>class Requirement < ActiveRecord::Base
  include PublicActivity::Model
  tracked owner: Proc.new { |controller, model| controller.current_user }

  validates :label, :presence => true,
                   :length => {:minimum => 3, :maximum => 255}

  belongs_to :letter
  #belongs_to :user
  belongs_to :author, :class_name => 'User'
  has_many :user, through: :user_requirement
  has_many :user_requirement, dependent: :destroy # ответственные за Требование
  has_many :task

  attr_accessible :label, :date, :source, :duedate, :body, :status, :status_name, :result,
                  :author_name, :user_id, :letter_id

  def author_name
    author.try(:displayname)
  end

  def author_name=(name)
    self.author = User.find_by_displayname(name) if name.present?
  end

  def status_name
    REQUIREMENT_STATUS.key(status)
  end
  
  def status_name=(key)
    self.status = REQUIREMENT_STATUS[key]
  end

  def name<commit_msg>fix for heroku<commit_after>class Requirement < ActiveRecord::Base
  include PublicActivity::Model
  tracked owner: Proc.new { |controller, model| controller.current_user }

  validates :label, :presence => true,
                   :length => {:minimum => 3, :maximum => 255}

  belongs_to :letter
  #belongs_to :user
  belongs_to :author, :class_name => 'User'
  has_many :user, through: :user_requirement
  has_many :user_requirement, dependent: :destroy # ответственные за Требование
  has_many :task

  attr_accessible :label, :date, :source, :duedate, :body, :status, :status_name, :result,
                  :author_name, :author, :letter_id

  def author_name
    author.try(:displayname)
  end

  def author_name=(name)
    self.author = User.find_by_displayname(name) if name.present?
  end

  def status_name
    REQUIREMENT_STATUS.key(status)
  end
  
  def status_name=(key)
    self.status = REQUIREMENT_STATUS[key]
  end

  def name
{'fraction_non_alphanumeric': 0.10465116279069768, 'fraction_numerical': 0.004228329809725159, 'mean_word_length': 3.8414322250639388, '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': '1327213', 'n_tokens_mistral': 658, 'n_tokens_neox': 621, 'n_words': 151}