Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/models/normalize_primo_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,18 @@ def author_link(author)
'&tab=',
ENV.fetch('PRIMO_TAB'),
'&query=creator,exact,',
URI.encode_uri_component(author),
encode_author(author),
'&offset=0',
'&lang=en'].join

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method has too many lines. [11/10] [rubocop:Metrics/MethodLength]

end

# Replace commas with box drawings light horizontal characters (Unicode U+2500) to avoid them
# being parsed as query separators.
def encode_author(author)
author_with_commas_replaced = author.gsub(',', '─')
URI.encode_uri_component(author_with_commas_replaced)
end

def thumbnail
return unless @record['pnx']['addata'] && @record['pnx']['addata']['isbn']

Expand Down
2 changes: 1 addition & 1 deletion test/models/normalize_primo_record_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def cdi_record
test 'constructs author search links' do
normalized = NormalizePrimoRecord.new(full_record, 'test').normalize
creator_link = normalized[:creators].first[:link]
assert_match 'nde/search?vid=01MIT_INST:NDE&search_scope=all&mode=advanced&tab=all&query=creator,exact,Smith%2C%20John%20A.&offset=0&lang=en',
assert_match 'nde/search?vid=01MIT_INST:NDE&search_scope=all&mode=advanced&tab=all&query=creator,exact,Smith%E2%94%80%20John%20A.&offset=0&lang=en',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [152/120] [rubocop:Layout/LineLength]

creator_link
end

Expand Down