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
15 16 17 |
# File 'app/models/backlog.rb', line 15 def active_tasks tasks.find(:all, :conditions => "finished_at IS NULL", :order => "position") end |
#enable_invoicing? ⇒ Boolean
34 35 36 |
# File 'app/models/backlog.rb', line 34 def enable_invoicing? work_account && work_account.enable_invoicing? end |
#first_active_period ⇒ Object
27 28 29 30 31 32 |
# File 'app/models/backlog.rb', line 27 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
19 20 21 |
# File 'app/models/backlog.rb', line 19 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
23 24 25 |
# File 'app/models/backlog.rb', line 23 def tasks_with_children tasks.map {|t| t.self_with_children}.flatten end |
#track_done? ⇒ Boolean
38 39 40 |
# File 'app/models/backlog.rb', line 38 def track_done? not work_account.nil? end |
#track_times? ⇒ Boolean
42 43 44 |
# File 'app/models/backlog.rb', line 42 def track_times? work_account && work_account.track_times? end |