<commit_before>class Issue < ActiveRecord::Base
  include Upvote

  belongs_to :project
  belongs_to :milestone
  belongs_to :author, :class_name => "User"
  belongs_to :assignee, :class_name => "User"
  has_many :notes, :as => :noteable, :dependent => :destroy

  attr_protected :author, :author_id, :project, :project_id
  attr_accessor :author_id_of_changes

  validates_presence_of :project_id
  validates_presence_of :assignee_id
  validates_presence_of :author_id

  delegate :name,
           :email,
           :to => :author,
           :prefix => true

  delegate :name,
           :email,
           :to => :assignee,
           :prefix => true

  validates :title,
            :presence => true,
            :length   => { :within => 0..255 }

  validates :description,
            :length   => { :within => 0..2000 }

  scope :critical, where(:critical => true)
  scope :non_critical, where(:critical => false)

  scope :opened, where(:closed => false)
  scope :closed, where(:closed => true)
  scope :assigned, lambda { |u| where(:assignee_id => u.id)}

  acts_as_list

  def self.open_for(user)
    opened.assigned(user)
  end

  def self.search query
    where("title like :query", :query => "%#{query}%")
  end

  def today?
    Date.today == created_at.to_date
  end

  def new?
    today? && created_at == updated_at
  end

  # Return the number of +1 comments (upvotes)
  def upvotes
    notes.select(&:upvote?).size
  end

  def is_being_reassigned?
    assignee_id_changed?
  end

  def is_being_closed?
    closed_changed? && closed<commit_msg>Remove upvotes method from Issue.<commit_after>class Issue < ActiveRecord::Base
  include Upvote

  belongs_to :project
  belongs_to :milestone
  belongs_to :author, :class_name => "User"
  belongs_to :assignee, :class_name => "User"
  has_many :notes, :as => :noteable, :dependent => :destroy

  attr_protected :author, :author_id, :project, :project_id
  attr_accessor :author_id_of_changes

  validates_presence_of :project_id
  validates_presence_of :assignee_id
  validates_presence_of :author_id

  delegate :name,
           :email,
           :to => :author,
           :prefix => true

  delegate :name,
           :email,
           :to => :assignee,
           :prefix => true

  validates :title,
            :presence => true,
            :length   => { :within => 0..255 }

  validates :description,
            :length   => { :within => 0..2000 }

  scope :critical, where(:critical => true)
  scope :non_critical, where(:critical => false)

  scope :opened, where(:closed => false)
  scope :closed, where(:closed => true)
  scope :assigned, lambda { |u| where(:assignee_id => u.id)}

  acts_as_list

  def self.open_for(user)
    opened.assigned(user)
  end

  def self.search query
    where("title like :query", :query => "%#{query}%")
  end

  def today?
    Date.today == created_at.to_date
  end

  def new?
    today? && created_at == updated_at
  end

  def is_being_reassigned?
    assignee_id_changed?
  end

  def is_being_closed?
    closed_changed? && closed
{'fraction_non_alphanumeric': 0.11922698984605307, 'fraction_numerical': 0.006223386832623649, 'mean_word_length': 3.0131406044678055, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '6157481', 'n_tokens_mistral': 1066, 'n_tokens_neox': 999, 'n_words': 248}