From 99e3f093fcd1fda9447ebcfefd6661e6053f76a4 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 30 Apr 2022 18:20:45 -0300 Subject: [PATCH] ordenar de menor a mayor --- app/controllers/stats_controller.rb | 3 +++ 1 file changed, 3 insertions(+) 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