Statistics for longest running projects now includes completed and hidden projects. fixes #1725

This commit is contained in:
Reinier Balt 2014-11-05 17:07:21 +01:00
parent ff9edcc309
commit 2883d1b7f4
6 changed files with 57 additions and 27 deletions

View file

@ -138,6 +138,14 @@ class Project < ActiveRecord::Base
@age_in_days ||= (Time.current.to_date - created_at.to_date).to_i + 1
end
def running_time
if completed_at.nil?
return age_in_days
else
return (completed_at.to_date - created_at.to_date).to_i + 1
end
end
def self.import(filename, params, user)
count = 0
CSV.foreach(filename, headers: true) do |row|