Class: Backlog
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Backlog
- Defined in:
- app/models/backlog.rb
Instance Method Summary collapse
- #active_tasks ⇒ Object
- #enable_invoicing? ⇒ Boolean
- #first_active_period ⇒ Object
- #recent_tasks ⇒ Object
- #tasks_with_children ⇒ Object
- #track_done? ⇒ Boolean
- #track_times? ⇒ Boolean
Instance Method Details
#active_tasks ⇒ Object
14 15 16 |
# File 'app/models/backlog.rb', line 14 def active_tasks tasks.find(:all, :conditions => "finished_at IS NULL", :order => "position") end |
#enable_invoicing? ⇒ Boolean
33 34 35 |
# File 'app/models/backlog.rb', line 33 def enable_invoicing? work_account && work_account.enable_invoicing? end |
#first_active_period ⇒ Object
26 27 28 29 30 31 |
# File 'app/models/backlog.rb', line 26 def first_active_period t = active_tasks periods = t.map {|t| t.period}.compact.uniq periods = periods.select {|p| p.active?} periods.sort_by {|p| p.end_on}.first end |
#recent_tasks ⇒ Object
18 19 20 |
# File 'app/models/backlog.rb', line 18 def recent_tasks Task.find(:all, :conditions => "period_id = #{periods.first.id} AND (position IS NOT NULL OR finished_at >= '#{1.week.ago.iso8601}')", :order => "position, finished_at") end |
#tasks_with_children ⇒ Object
22 23 24 |
# File 'app/models/backlog.rb', line 22 def tasks_with_children tasks.map {|t| t.self_with_children}.flatten end |
#track_done? ⇒ Boolean
37 38 39 |
# File 'app/models/backlog.rb', line 37 def track_done? not work_account.nil? end |
#track_times? ⇒ Boolean
41 42 43 |
# File 'app/models/backlog.rb', line 41 def track_times? work_account && work_account.track_times? end |