You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
526 B
21 lines
526 B
class Version < ApplicationRecord
|
|
belongs_to :project
|
|
has_many :issues, class_name: "Issue", foreign_key: "fixed_version_id"
|
|
belongs_to :user, optional: true
|
|
|
|
scope :version_includes, ->{includes(:issues, :user)}
|
|
|
|
def open_issues_count
|
|
issues.select(:id,:status_id).where(status_id: [1,2,3,4,6]).size
|
|
end
|
|
|
|
def close_issues_count
|
|
issues.select(:id,:status_id).where(status_id: 5).size
|
|
end
|
|
|
|
def version_user
|
|
User.select(:login, :lastname,:firstname, :nickname)&.find_by_id(self.user_id)
|
|
end
|
|
|
|
end
|