Class: Lazylead::Task::Teammate

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lazylead/task/loading.rb

Overview

The teammate’s tickets.

Instance Method Summary collapse

Constructor Details

#initialize(user, tasks = []) ⇒ Teammate

Returns a new instance of Teammate.



56
57
58
59
# File 'lib/lazylead/task/loading.rb', line 56

def initialize(user, tasks = [])
  @user = user
  @tasks = tasks
end

Instance Method Details

#free?Boolean

Returns:

  • (Boolean)


61
62
63
64
# File 'lib/lazylead/task/loading.rb', line 61

def free?
  return true if @tasks.nil?
  @tasks.empty?
end

#nextObject



66
67
68
# File 'lib/lazylead/task/loading.rb', line 66

def next
  @tasks.reject { |t| t.duedate.nil? }.map { |t| t.duedate.to_date }.min
end

#sprints(label) ⇒ Object



74
75
76
77
# File 'lib/lazylead/task/loading.rb', line 74

def sprints(label)
  return @tasks.group_by(&:sprint).sort if label.nil? || label.blank?
  @tasks.group_by { |t| t.sprint(label) }.sort
end

#to_sObject



70
71
72
# File 'lib/lazylead/task/loading.rb', line 70

def to_s
  "#{id} has #{total} tasks"
end