mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 21:56:21 +00:00
ordenar en la base de datos
This commit is contained in:
parent
35d16b1139
commit
755db601a1
1 changed files with 1 additions and 3 deletions
|
@ -56,14 +56,12 @@ class StatsController < ApplicationController
|
||||||
rollup_scope.where(interval: interval, name: "host|#{column}")
|
rollup_scope.where(interval: interval, name: "host|#{column}")
|
||||||
.where_dimensions(host: hostnames)
|
.where_dimensions(host: hostnames)
|
||||||
.group("dimensions->>'#{column}'")
|
.group("dimensions->>'#{column}'")
|
||||||
|
.order('sum(value) desc')
|
||||||
.sum(:value)
|
.sum(:value)
|
||||||
.transform_values(&:to_i)
|
.transform_values(&:to_i)
|
||||||
.transform_values do |v|
|
.transform_values do |v|
|
||||||
v * nodes
|
v * nodes
|
||||||
end
|
end
|
||||||
.sort_by do |_, v|
|
|
||||||
v
|
|
||||||
end.reverse.to_h
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue