diff --git a/app/controllers/concerns/statistics.rb b/app/controllers/concerns/statistics.rb index 6d91c67..e2f756f 100644 --- a/app/controllers/concerns/statistics.rb +++ b/app/controllers/concerns/statistics.rb @@ -25,8 +25,8 @@ class Statistics < Rails::Application end def amount_distribution - Transaction.group("round(amount / 1000.0, 2)").count.inject(Hash.new) do |hash, (group, count)| - hash.merge({10 * group.to_i => count}) + Transaction.group("round(amount / 1000)").count.inject(Hash.new) do |hash, (group, count)| + hash.merge({10 * group.to_f => count}) end end diff --git a/app/views/pages/landing.html.haml b/app/views/pages/landing.html.haml index eef0fbc..80f85a5 100644 --- a/app/views/pages/landing.html.haml +++ b/app/views/pages/landing.html.haml @@ -30,4 +30,5 @@ = pie_chart @statistics.by_issuer .pure-u-1-2 %h3 Distribution of Transaction Amounts + = @statistics.amount_distribution = column_chart @statistics.amount_distribution