Class: Trackington::Task

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

Constant Summary collapse

STATUSES =
%w(open in_progress resolved closed reopened)
PRIORITIES =
%w(blocker critical major minor trivial)
TYPES =
%w(bug improvement new_feature story task)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db_task) ⇒ Task

Returns a new instance of Task.



66
67
68
69
70
# File 'lib/trackington/app/tasks.rb', line 66

def initialize(db_task)
  basic_properties(db_task)
  status_properties(db_task)
  person_properties(db_task)
end

Instance Attribute Details

#assigned_toObject (readonly)

Returns the value of attribute assigned_to.



64
65
66
# File 'lib/trackington/app/tasks.rb', line 64

def assigned_to
  @assigned_to
end

#created_byObject (readonly)

Returns the value of attribute created_by.



64
65
66
# File 'lib/trackington/app/tasks.rb', line 64

def created_by
  @created_by
end

#descriptionObject (readonly)

Returns the value of attribute description.



63
64
65
# File 'lib/trackington/app/tasks.rb', line 63

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



63
64
65
# File 'lib/trackington/app/tasks.rb', line 63

def id
  @id
end

#priorityObject (readonly)

Returns the value of attribute priority.



64
65
66
# File 'lib/trackington/app/tasks.rb', line 64

def priority
  @priority
end

#statusObject (readonly)

Returns the value of attribute status.



64
65
66
# File 'lib/trackington/app/tasks.rb', line 64

def status
  @status
end

#task_typeObject (readonly)

Returns the value of attribute task_type.



64
65
66
# File 'lib/trackington/app/tasks.rb', line 64

def task_type
  @task_type
end

#time_actualObject (readonly)

Returns the value of attribute time_actual.



63
64
65
# File 'lib/trackington/app/tasks.rb', line 63

def time_actual
  @time_actual
end

#time_plannedObject (readonly)

Returns the value of attribute time_planned.



63
64
65
# File 'lib/trackington/app/tasks.rb', line 63

def time_planned
  @time_planned
end

#titleObject (readonly)

Returns the value of attribute title.



63
64
65
# File 'lib/trackington/app/tasks.rb', line 63

def title
  @title
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/trackington/app/tasks.rb', line 72

def active?
  %w(in_progress reopened open).include? @status
end

#update(data) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/trackington/app/tasks.rb', line 76

def update(data)
  db_task = Models::Task.find(@id)

  data.each do |property, new_value|
    db_task[property] = get_value(property, new_value) if property != :id
  end

  db_task.save

  basic_properties(db_task)
  status_properties(db_task)
  person_properties(db_task)
end