class Trackington::Sprint

Attributes

end_time[R]
id[R]
is_active[R]
is_backlog[R]
start_time[R]
tasks[R]

Public Class Methods

new(sprint) click to toggle source
# File lib/trackington/app/sprints.rb, line 61
def initialize(sprint)
  @id = sprint.id
  @start_time = sprint.start_time
  @end_time = sprint.end_time
  @is_active = sprint.is_active
  @is_backlog = sprint.is_backlog
  @project_id = sprint.project_id
  @tasks = TaskRepository.new(@id)
end

Public Instance Methods

add_task(user_id, data) click to toggle source
# File lib/trackington/app/sprints.rb, line 83
def add_task(user_id, data)
  check_user_role user_id
  data[:created_by] = user_id
  @tasks.add(data)
end
all() click to toggle source
# File lib/trackington/app/sprints.rb, line 89
def all
  @tasks.all
end
end() click to toggle source
# File lib/trackington/app/sprints.rb, line 77
def end
  sprint = Models::Sprint.find(@id)
  sprint.is_active = false
  sprint.save
end
start() click to toggle source
# File lib/trackington/app/sprints.rb, line 71
def start
  sprint = Models::Sprint.find(@id)
  sprint.is_active = true
  sprint.save
end

Private Instance Methods

check_user_role(user_id, role = 'spectator') click to toggle source
# File lib/trackington/app/sprints.rb, line 95
def check_user_role(user_id, role = 'spectator')
  repo = ProjectRepository.new
  project = repo.get(@project_id)
  project.user_is?(user_id, role)
end