Skip to content

Commit

Permalink
Merge pull request #345 from everypolitician/report-sort-groups-by-size
Browse files Browse the repository at this point in the history
Sort report groups by biggest first
  • Loading branch information
chrismytton authored Jul 1, 2016
2 parents 38307cf + fd3d930 commit 69a4bcc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/reports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def stats
end

def groups
@groups ||= raw_stats[:totals][:parties].map { |slug, group_stats| GroupReport.new(slug, group_stats, raw_stats, legislative_periods) }
@groups ||= raw_stats[:totals][:parties].map { |slug, group_stats| GroupReport.new(slug, group_stats, raw_stats, legislative_periods) }.sort_by do |group|
-group.total
end
end

def legislative_periods
Expand Down Expand Up @@ -122,7 +124,9 @@ def stats
end

def groups
@groups = legislative_period_stats[:parties].map { |_, group_stats| LegislativePeriodGroupReport.new(group_stats) }
@groups = legislative_period_stats[:parties].map { |_, group_stats| LegislativePeriodGroupReport.new(group_stats) }.sort_by do |group|
-group.total
end
end
end

Expand Down

0 comments on commit 69a4bcc

Please sign in to comment.