Skip to content

Commit

Permalink
Merge pull request #425 from Homebrew/order_all_core_formulae_count
Browse files Browse the repository at this point in the history
cmd/formula-analytics: order core formulae by count.
  • Loading branch information
MikeMcQuaid authored Jan 18, 2024
2 parents 23e5c20 + ec2ec17 commit e19d3b4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/formula-analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,21 @@ def influx_analytics(args)

json[:items].each do |item|
item.delete(:number)
item[:count] = format_count(item[:count])

formula_name, = item[dimension_key].split.first
next if formula_name.include?("/")

core_formula_items[formula_name] ||= []
core_formula_items[formula_name] << item
end

json.delete(:items)

core_formula_items.each_value do |items|
items.sort_by! { |item| -item[:count] }
items.each do |item|
item[:count] = format_count(item[:count])
end
end

json[:formulae] = core_formula_items.sort_by { |name, _| name }.to_h
else
json[:items].sort_by! do |item|
Expand Down

0 comments on commit e19d3b4

Please sign in to comment.