Skip to content

Commit

Permalink
Optimization of tag page contributor count (#1719)
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren committed Oct 24, 2017
1 parent 6380a23 commit 3955e17
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/controllers/tag_controller.rb
Expand Up @@ -83,11 +83,12 @@ def show
@wikis = nodes if @node_type == 'wiki'
@nodes = nodes if @node_type == 'maps'
@title = params[:id]
# the following could be refactored into a Tag.contributor_count method:
notes = Node.where(status: 1, type: 'note')
.includes(:revision, :tag)
.where('term_data.name = ?', params[:id])
users = notes.collect(&:author).uniq
@length=users.length || 0
.select('node.nid, node.type, node.uid, node.status, term_data.*, community_tags.*')
.includes(:tag)
.where('term_data.name = ?', params[:id])
@length = notes.collect(&:uid).uniq.length || 0

respond_with(nodes) do |format|
format.html { render 'tag/show' }
Expand Down

0 comments on commit 3955e17

Please sign in to comment.