fix amount distribution, still ugly though

This commit is contained in:
Felix Van der Jeugt 2015-09-14 17:30:52 +02:00
parent 2a51355046
commit 9191e12ce9
2 changed files with 3 additions and 2 deletions

View file

@ -25,8 +25,8 @@ class Statistics < Rails::Application
end end
def amount_distribution def amount_distribution
Transaction.group("round(amount / 1000.0, 2)").count.inject(Hash.new) do |hash, (group, count)| Transaction.group("round(amount / 1000)").count.inject(Hash.new) do |hash, (group, count)|
hash.merge({10 * group.to_i => count}) hash.merge({10 * group.to_f => count})
end end
end end

View file

@ -30,4 +30,5 @@
= pie_chart @statistics.by_issuer = pie_chart @statistics.by_issuer
.pure-u-1-2 .pure-u-1-2
%h3 Distribution of Transaction Amounts %h3 Distribution of Transaction Amounts
= @statistics.amount_distribution
= column_chart @statistics.amount_distribution = column_chart @statistics.amount_distribution