<commit_before>module RepresentativeImageHelper
    require 'openlibrary'

    def display_representative_image(document, full_size=false )
       unless representative_image_url(document, full_size).nil?
          if full_size
             return link_to(image_tag(representative_image_url(document, full_size), alt:document['title_t'], class: 'large-cover-image'), representative_image_url(document, full_size))
          else
             return link_to(image_tag(representative_image_url(document, full_size), alt:document['title_t'], class:(full_size ? 'large-cover-image' : 'thumbnail-cover-image')), :controller => "catalog", :action => "show", :id => document.id)
          end
       else
          return nil
       end
    end

    def representative_image_url(document, full_size=false)
       if document.has? 'isbn_t'
          isbns = []
          case document['isbn_t']
             when Array then isbns = document['isbn_t']
             when String then isbns.push(document['isbn_t'])
             else
                isbns = document['isbn_t'].to_a
          end
          client = Openlibrary::Client.new
          view = Openlibrary::View
          isbns.each do |isbn|
             book = view.find_by_isbn(isbn)
             unless book.nil?
                unless book.thumbnail_url.nil?
                   unless full_size
                      return book.thumbnail_url
                   else
                      return book.thumbnail_url.sub('-S.jpg', '-M.jpg')
                   end
                end
             end
          end
       else
          return nil
       end
       return nil
    end
end<commit_msg>making cover image clicks link to large version of image<commit_after>module RepresentativeImageHelper
    require 'openlibrary'

    def display_representative_image(document, full_size=false )
       unless representative_image_url(document, 'L').nil?
          if full_size
             return link_to(image_tag(representative_image_url(document, 'M'), alt:document['title_t'], class: 'large-cover-image'), representative_image_url(document, 'L'))
          else
             return link_to(image_tag(representative_image_url(document, 'M'), alt:document['title_t'], class:(full_size ? 'large-cover-image' : 'thumbnail-cover-image')), :controller => "catalog", :action => "show", :id => document.id)
          end
       else
          return nil
       end
    end

    def representative_image_url(document, size='S')
       if document.has? 'isbn_t'
          isbns = []
          case document['isbn_t']
             when Array then isbns = document['isbn_t']
             when String then isbns.push(document['isbn_t'])
             else
                isbns = document['isbn_t'].to_a
          end
             client = Openlibrary::Client.new
             view = Openlibrary::View
             isbns.each do |isbn|
                book = view.find_by_isbn(isbn)
                unless book.nil?
                   unless book.thumbnail_url.nil?
                      if 'S' == size
                         return book.thumbnail_url
                      else
                         return book.thumbnail_url.sub('-S.jpg', '-'.concat(size).concat('.jpg'))
                      end
                   end
                end
             end
       else
          return nil
       end
       return nil
    end
end
{'fraction_non_alphanumeric': 0.09346347234545992, 'fraction_numerical': 0.0, 'mean_word_length': 1.8043117744610282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5888738', 'n_tokens_mistral': 935, 'n_tokens_neox': 900, 'n_words': 199}