Minor refactoring in stats partial.
This commit is contained in:
parent
4b6499d529
commit
f1b71a5588
2 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -14,7 +14,7 @@ unless global_avg == 0 or global_avg.nan?
|
|||
%>
|
||||
Engagement Deiner Bestellgruppe
|
||||
<div class="stats-bar" style="width:<%= length_of_group_bar -%>px; background-color:<%= color -%>">
|
||||
<%= ((group_avg / global_avg) * 100).to_i -%><%= " Äpfel" if length_of_group_bar > 50 -%>
|
||||
<%= @ordergroup.apples -%><%= " Äpfel" if length_of_group_bar > 50 -%>
|
||||
</div>
|
||||
Durchschnittsengagement
|
||||
<div class="stats-bar" style="width:<%= length_of_global_bar -%>px">
|
||||
|
|
Loading…
Reference in a new issue