diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 84ca3028..e00b9822 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -51,6 +51,9 @@ class StatsController < ApplicationController .group("dimensions->>'#{column}'") .sum(:value) .transform_values(&:to_i) + .sort_by do |_, v| + v.last + end.reverse.to_h end end end