mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Some minor cleanups
1. Change map to keys 2. Remove overshadow 3. Remove var
This commit is contained in:
@@ -94,10 +94,10 @@ class IncomingLinksReport
|
||||
num_clicks = num_clicks.to_a.sort_by {|x| x[1]}.last(10).reverse # take the top 10
|
||||
report.data = []
|
||||
topics = Topic.select('id, slug, title').where('id in (?)', num_clicks.map {|z| z[0]}).all
|
||||
num_clicks.each do |topic_id, num_clicks|
|
||||
num_clicks.each do |topic_id, num_clicks_element|
|
||||
topic = topics.find {|t| t.id == topic_id}
|
||||
if topic
|
||||
report.data << {topic_id: topic_id, topic_title: topic.title, topic_slug: topic.slug, num_clicks: num_clicks}
|
||||
report.data << {topic_id: topic_id, topic_title: topic.title, topic_slug: topic.slug, num_clicks: num_clicks_element}
|
||||
end
|
||||
end
|
||||
report.data
|
||||
|
||||
Reference in New Issue
Block a user