Skip to content

Commit

Permalink
Fix grouping and sorting for versions >= 0.100.x (home-assistant#10775)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwradcliffe authored and frenck committed Oct 15, 2019
1 parent aaa6f71 commit 545a865
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions plugins/filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,10 @@ def group_components_by_release(input)
if minor.length == 1
"#{major}.X"
else
"#{major}.#{minor[0]}X"
"#{major}.#{minor.chop}X"
end
}.map { |v|
sort_key = v[1][-1]["sort_key"]
if v[0] == "0.X"
sort_key = "0.01" # Ensure 0.X is always sorted at bottom.
end

total_new_components = 0

Expand All @@ -115,7 +112,7 @@ def group_components_by_release(input)
end

{ "label" => v[0], "versions" => v[1], "new_components_count" => total_new_components, "sort_key" => sort_key }
}.sort_by { |v| v["sort_key"] }.reverse
}.sort_by { |v| Gem::Version.new(v["sort_key"]) }.reverse
end

# Get version N behind current
Expand Down

0 comments on commit 545a865

Please sign in to comment.