Class: Trackington::Sprint

Inherits:
Object
  • Object
show all
Defined in:
lib/trackington/app/sprints.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sprint) ⇒ Sprint

Returns a new instance of Sprint.



61
62
63
64
65
66
67
68
69
# 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

Instance Attribute Details

#end_timeObject (readonly)

Returns the value of attribute end_time.



59
60
61
# File 'lib/trackington/app/sprints.rb', line 59

def end_time
  @end_time
end

#idObject (readonly)

Returns the value of attribute id.



59
60
61
# File 'lib/trackington/app/sprints.rb', line 59

def id
  @id
end

#is_activeObject (readonly)

Returns the value of attribute is_active.



59
60
61
# File 'lib/trackington/app/sprints.rb', line 59

def is_active
  @is_active
end

#is_backlogObject (readonly)

Returns the value of attribute is_backlog.



59
60
61
# File 'lib/trackington/app/sprints.rb', line 59

def is_backlog
  @is_backlog
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



59
60
61
# File 'lib/trackington/app/sprints.rb', line 59

def start_time
  @start_time
end

#tasksObject (readonly)

Returns the value of attribute tasks.



59
60
61
# File 'lib/trackington/app/sprints.rb', line 59

def tasks
  @tasks
end

Instance Method Details

#add_task(user_id, data) ⇒ Object



83
84
85
86
87
# 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

#allObject



89
90
91
# File 'lib/trackington/app/sprints.rb', line 89

def all
  @tasks.all
end

#endObject



77
78
79
80
81
# File 'lib/trackington/app/sprints.rb', line 77

def end
  sprint = Models::Sprint.find(@id)
  sprint.is_active = false
  sprint.save
end

#startObject



71
72
73
74
75
# File 'lib/trackington/app/sprints.rb', line 71

def start
  sprint = Models::Sprint.find(@id)
  sprint.is_active = true
  sprint.save
end