diff options
Diffstat (limited to 'app/models/version.rb')
-rw-r--r-- | app/models/version.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/version.rb b/app/models/version.rb index 266346c7b..f9395c5d9 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -34,6 +34,16 @@ class Version < ActiveRecord::Base effective_date end + # Returns the total estimated time for this version + def estimated_hours + @estimated_hours ||= fixed_issues.sum(:estimated_hours).to_f + end + + # Returns the total reported time for this version + def spent_hours + @spent_hours ||= TimeEntry.sum(:hours, :include => :issue, :conditions => ["#{Issue.table_name}.fixed_version_id = ?", id]).to_f + end + # Returns true if the version is completed: due date reached and no open issues def completed? effective_date && (effective_date <= Date.today) && (open_issues_count == 0) |