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
931 B

class Backlog
unloadable
attr_accessor :sprint
attr_accessor :stories
def self.owner_backlogs(project, limit = nil)
backlogs = Sprint.apply_to(project).open.displayed_right(project).order_by_name
backlogs.map{ |sprint| new(:stories => sprint.stories(project, :limit => limit), :owner_backlog => true, :sprint => sprint)}
end
def self.sprint_backlogs(project)
sprints = Sprint.apply_to(project).open.displayed_left(project).order_by_date
sprints.map{ |sprint| new(:stories => sprint.stories(project), :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