<commit_before>class TagsController < ApplicationController
  def show
    @tag = Tag.find_by_id(params[:id])
    taggings = @tag.taggings
    @tagged_objects = select_authorised taggings.collect{|tagging| tagging.taggable}
    
    if @tagged_objects.empty?
      flash.now[:notice]="No objects found with tag '<b>#{@tag.name}</b>'."
    else
      flash.now[:notice]="#{@tagged_objects.size} #{@tagged_objects.size==1 ? 'item' : 'items'} found with tag '<b>#{@tag.name}</b>'."
    end
    respond_to do |format|
      format.html # show.html.erb
    end    
  end
  
  private  

  #Removes all results from the search results collection passed in that are not Authorised to show for the current_user
  def select_authorised collection
    collection.select {|el| Authorization.is_authorized?("show", nil, el, current_user)}
  end
end<commit_msg>fixed duplicate lists items for a tag, and added a functional test<commit_after>class TagsController < ApplicationController
  def show
    @tag = Tag.find_by_id(params[:id])
    taggings = @tag.taggings
    @tagged_objects = select_authorised taggings.collect{|tagging| tagging.taggable}.uniq
    
    if @tagged_objects.empty?
      flash.now[:notice]="No objects found with tag '<b>#{@tag.name}</b>'."
    else
      flash.now[:notice]="#{@tagged_objects.size} #{@tagged_objects.size==1 ? 'item' : 'items'} found with tag '<b>#{@tag.name}</b>'."
    end
    respond_to do |format|
      format.html # show.html.erb
    end    
  end
  
  private  

  #Removes all results from the search results collection passed in that are not Authorised to show for the current_user
  def select_authorised collection
    collection.select {|el| Authorization.is_authorized?("show", nil, el, current_user)}
  end
end
{'fraction_non_alphanumeric': 0.12086659064994298, 'fraction_numerical': 0.0011402508551881414, 'mean_word_length': 3.808219178082192, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2211948', 'n_tokens_mistral': 563, 'n_tokens_neox': 552, 'n_words': 148}