simplify code

This commit is contained in:
Joffrey JAFFEUX 2018-04-19 18:26:30 +02:00 committed by GitHub
parent 0e414d0890
commit 58a53017c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -278,8 +278,9 @@ class Report
.order('COUNT(DISTINCT ip_address) DESC, COUNT(*) DESC')
.limit(20).to_a
label = Proc.new { |key| I18n.t("reports.trending_search.labels.#{key}") }
report.labels = [:term, :searches, :unique].map {|key| label.call(key) }
report.labels = [:term, :searches, :unique].map { |key|
I18n.t("reports.trending_search.labels.#{key}")
}
trends.each do |trend|
report.data << [trend.term, trend.searches, trend.unique]