OpenProject is the leading open source project management software.
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.
openproject/app/models/backlog.rb

36 lines
909 B

class Backlog
unloadable
attr_accessor :sprint
attr_accessor :stories
def self.owner_backlogs(project, limit = nil)
versions = Version.open.displayed_right(project).sort_by{|v| v.name}
versions.map{ |version| new(:stories => Story.backlog(project, version.id, :limit => limit), :owner_backlog => true, :sprint => version)}
end
def self.sprint_backlogs(project)
sprints = Sprint.open_sprints(project).displayed_left(project)
sprints.map{ |sprint| new(:stories => sprint.stories, :sprint => sprint) }
end
def initialize(options = {})
options = options.with_indifferent_access
@sprint = options['sprint']
@stories = options['stories']
@owner_backlog = options['owner_backlog']
end
def updated_on
@stories.max_by(&:updated_on).try(:updated_on)
end
def owner_backlog?
!!@owner_backlog
end
def sprint_backlog?
!owner_backlog?
end
end