Sha256: d8f6c42d29a309a3cfaab062049307a77f3fb3ccf67859b90f3e4dff47f7e08d
Contents?: true
Size: 946 Bytes
Versions: 3
Compression:
Stored size: 946 Bytes
Contents
class Backlog < ActiveRecord::Base has_many :periods, :order => 'start_on' 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 def estimate_data(date) total = 0 periods.each do |period| total += period.estimate_data(date) end total end def work_data(date) total = 0 periods.each do |period| total += period.work_data(date) end total end def required_speed return 0 if periods.empty? estimate_data(Date.today) / ((periods.last.end_on - Date.today).to_i > 0 ? (periods.last.end_on - Date.today).to_i : 1) end def first_active_period periods.each do |period| return period if period.active? end return periods.last end def enable_invoicing? !invoice_code.nil? && invoice_code.length > 0 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
backlog-0.0.0 | app/models/backlog.rb |
backlog-0.0.1 | app/models/backlog.rb |
backlog-0.0.2 | app/models/backlog.rb |