<commit_before>module Shared::ListsModule    
  PLAIN_VIEW = 'plain'
  TAXONOMIC_VIEW = 'taxonomic'
  PHOTO_VIEW = 'photo'
  LIST_VIEWS = [PLAIN_VIEW, TAXONOMIC_VIEW, PHOTO_VIEW]
  
  ## RESTful actions ###########################################################
  def index
    redirect_to :controller => 'welcome'
  end
  
  def show
    @listed_taxa ||= @list.listed_taxa.paginate(@find_options)
    @iconic_taxon_counts = get_iconic_taxon_counts(@list, @iconic_taxa)
    @total_listed_taxa ||= @list.listed_taxa.count
    
    @total_observed_taxa ||= @list.listed_taxa.count(:conditions => "last_observation_id > 0")
    
    @view = params[:view]
    @view = PHOTO_VIEW unless LIST_VIEWS.include?(@view)
    
    case @view
    when TAXONOMIC_VIEW
      ancestor_ids = @listed_taxa.map do |lt|
        # If for some reason taxon_ancestor_ids wasn't set, set it now
        unless lt.taxon_ancestor_ids
          logger.info "[INFO] Updating listed taxa for #{lt.taxon} from lists/#{@list.id}"
          lt.taxon.update_listed_taxa
          lt.reload
        end
        lt.taxon_ancestor_ids.split(',')
      end
      ancestor_ids = ancestor_ids.uniq.compact
      unless ancestor_ids.empty?
        @ancestor_taxa = Taxon.find(ancestor_ids, :include => :taxon_names)
        @ancestor_taxa = @ancestor_taxa.select {|at| at.name != 'Life'}
        @ancestor_taxa.each do |at|
          @listed_taxa << ListedTaxon.new(:list => @list, :taxon => at)
        end
      end
<commit_msg>Fixed bug when people requested a check list from the lists controller.<commit_after>module Shared::ListsModule    
  PLAIN_VIEW = 'plain'
  TAXONOMIC_VIEW = 'taxonomic'
  PHOTO_VIEW = 'photo'
  LIST_VIEWS = [PLAIN_VIEW, TAXONOMIC_VIEW, PHOTO_VIEW]
  
  ## RESTful actions ###########################################################
  def index
    redirect_to :controller => 'welcome'
  end
  
  def show
    # Make sure request is being handled by the right controller
    if @list.is_a?(CheckList) && params[:controller] != CheckList.to_s.underscore.pluralize
      return redirect_to @list
    end
    
    @listed_taxa ||= @list.listed_taxa.paginate(@find_options)
    @iconic_taxon_counts = get_iconic_taxon_counts(@list, @iconic_taxa)
    @total_listed_taxa ||= @list.listed_taxa.count
    
    @total_observed_taxa ||= @list.listed_taxa.count(:conditions => "last_observation_id > 0")
    
    @view = params[:view]
    @view = PHOTO_VIEW unless LIST_VIEWS.include?(@view)
    
    case @view
    when TAXONOMIC_VIEW
      ancestor_ids = @listed_taxa.map do |lt|
        # If for some reason taxon_ancestor_ids wasn't set, set it now
        unless lt.taxon_ancestor_ids
          logger.info "[INFO] Updating listed taxa for #{lt.taxon} from lists/#{@list.id}"
          lt.taxon.update_listed_taxa
          lt.reload
        end
        lt.taxon_ancestor_ids.split(',')
      end
      ancestor_ids = ancestor_ids.uniq.compact
      unless ancestor_ids.empty?
        @ancestor_taxa = Taxon.find(ancestor_ids, :include => :taxon_names)
        @ancestor_taxa = @ancestor_taxa.select {|at| at.name != 'Life'}
        @ancestor_taxa.each do |at|
          @listed_taxa << ListedTaxon.new(:list => @list, :taxon => at)
        end
      end

{'fraction_non_alphanumeric': 0.13954924359370177, 'fraction_numerical': 0.0006174745291756715, 'mean_word_length': 3.16988416988417, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '3208965', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1130, 'n_words': 221}