class Trackington::TaskRepository
Constants
- PRIORITIES
- STATUSES
- TYPES
Public Class Methods
new(sprint_id)
click to toggle source
# File lib/trackington/app/tasks.rb, line 9 def initialize(sprint_id) @sprint_id = sprint_id end
Public Instance Methods
add(data)
click to toggle source
# File lib/trackington/app/tasks.rb, line 22 def add(data) data[:sprint_id] = @sprint_id task = Models::Task.new(data) task.save end
all()
click to toggle source
# File lib/trackington/app/tasks.rb, line 28 def all Models::Task.where(sprint_id: @sprint_id).map do |db_task| Task.new(db_task) end end
get(id)
click to toggle source
# File lib/trackington/app/tasks.rb, line 34 def get(id) db_task = Models::Task.where(sprint_id: @sprint_id, id: id).first Task.new(db_task) end
move_to(sprint_id)
click to toggle source
# File lib/trackington/app/tasks.rb, line 13 def move_to(sprint_id) tasks = Models::Task.where(sprint_id: sprint_id) tasks.each do |task| task.sprint_id = sprint_id if active?(task.status) task.save end end
priorities()
click to toggle source
# File lib/trackington/app/tasks.rb, line 43 def priorities PRIORITIES end
status_types()
click to toggle source
# File lib/trackington/app/tasks.rb, line 39 def status_types STATUSES end
types()
click to toggle source
# File lib/trackington/app/tasks.rb, line 47 def types TYPES end
Private Instance Methods
active?(status)
click to toggle source
# File lib/trackington/app/tasks.rb, line 53 def active?(status) %w(in_progress reopened open).include? status end