Minor refactoring in stats partial.

This commit is contained in:
benni 2012-06-24 21:43:36 +02:00
parent 4b6499d529
commit f1b71a5588
2 changed files with 7 additions and 1 deletions

View file

@ -62,6 +62,12 @@ class Ordergroup < Group
stats[:orders_sum] != 0 ? stats[:jobs_size].to_f / stats[:orders_sum].to_f : 0
end
# This is the ordergroup job per euro performance
# in comparison to the hole foodcoop average
def apples
((avg_jobs_per_euro / Ordergroup.avg_jobs_per_euro) * 100).to_i rescue 0
end
# Global average
def self.avg_jobs_per_euro
stats = Ordergroup.all.collect(&:stats)