We could just sum with SQL

This commit is contained in:
Lin Jen-Shin 2016-08-15 18:50:02 +08:00
parent 47ed793af9
commit 7d9bdac6ce

View file

@ -79,7 +79,7 @@ module Ci
end
def self.duration
where.not(duration: nil).pluck(:duration).inject(0, &:+)
where.not(duration: nil).sum(:duration)
end
def project_id