<commit_before>class Task < ActiveRecord::Base


  attr_accessible :description, :effective_hours, :estimated_hours, :label_id, :name, 
                  :priority, :project_id, :requirement_id, :status_id, :status_update_at, 
                  :task_father_id, :task_type, :goal_id, :task_depend_id, :assigned_users, 
                  :lock, :created_at


  belongs_to :label
  belongs_to :project
  belongs_to :requirement
  belongs_to :status
  belongs_to :task_father, :class_name => "Task", :foreign_key => "task_father_id"
  belongs_to :goal
  belongs_to :task_depend, :class_name => "Task", :foreign_key => "task_depdend_id"
  belongs_to :use_case

  has_one :bug
  has_one :evaluation
  has_many :notifications
  
  has_many :comments
  has_many :reported_hours
  has_many :document_tasks
  has_many :commits
  has_many :sub_tasks

  has_many :task_users
  has_many :users, :through => :task_users

  attr_accessible :user_ids

  validates :name, :presence => true
  validates :label, :presence => true  
  validates :estimated_hours, :numericality => { :greater_than_or_equal_to => 1 }

  def use_case_documents
    documents = []
    if not self.requirement.nil?
      self.requirement.use_cases.each do |use_case|
        documents.concat use_case.document_use_cases
      end
    end
    if not self.use_case.nil?
      documents.concat self.use_case.document_use_cases
    end<commit_msg>fixing documents for tasks<commit_after>class Task < ActiveRecord::Base


  attr_accessible :description, :effective_hours, :estimated_hours, :label_id, :name, 
                  :priority, :project_id, :requirement_id, :status_id, :status_update_at, 
                  :task_father_id, :task_type, :goal_id, :task_depend_id, :assigned_users, 
                  :lock, :created_at


  belongs_to :label
  belongs_to :project
  belongs_to :requirement
  belongs_to :status
  belongs_to :task_father, :class_name => "Task", :foreign_key => "task_father_id"
  belongs_to :goal
  belongs_to :task_depend, :class_name => "Task", :foreign_key => "task_depdend_id"
  belongs_to :use_case

  has_one :bug
  has_one :evaluation
  has_many :notifications
  
  has_many :comments
  has_many :reported_hours
  has_many :document_tasks
  has_many :commits
  has_many :sub_tasks

  has_many :task_users
  has_many :users, :through => :task_users

  attr_accessible :user_ids

  validates :name, :presence => true
  validates :label, :presence => true  
  validates :estimated_hours, :numericality => { :greater_than_or_equal_to => 1 }

  def use_case_documents
    documents = []
    if not self.requirement.nil?
      self.requirement.use_cases.each do |use_case|
        documents.concat use_case.document_projects
      end
    end
    if not self.use_case.nil?
      documents.concat self.use_case.document_projects
    end
{'fraction_non_alphanumeric': 0.08952042628774423, 'fraction_numerical': 0.0007104795737122557, 'mean_word_length': 3.8054607508532423, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '2925315', 'n_tokens_mistral': 989, 'n_tokens_neox': 946, 'n_words': 204}