Skip to content

Commit 43a0512

Browse files
authored
Merge pull request #324 from MITLibraries/use-298-limit-citation-to-cdi
Skip citation for Alma records
2 parents 074fd42 + fd4a8ec commit 43a0512

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

app/models/normalize_primo_record.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def links
115115
end
116116

117117
def citation
118+
# We don't want to include citations for Alma records at this time. If we include them in the future they need
119+
# to be cleaned up as they currently look like `Engineering village 2$$QEngineering village 2`
120+
return if alma_record?
118121
return unless @record['pnx']['display']
119122

120123
@record['pnx']['display']['ispartof']&.first

test/models/normalize_primo_record_test.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,19 @@ def cdi_record
8181
assert_empty normalized[:links]
8282
end
8383

84-
test 'normalizes citation' do
85-
normalized = NormalizePrimoRecord.new(full_record, 'test').normalize
84+
test 'normalizes citation for cdi records' do
85+
record = full_record.dup
86+
record['pnx']['control']['recordid'] = ['cdi_crossref_primary_10_1234_test_article']
87+
88+
normalized = NormalizePrimoRecord.new(record, 'test').normalize
8689
assert_equal 'Journal of Testing, Vol. 2, Issue 3', normalized[:citation]
8790
end
8891

92+
test 'skips citation for alma records' do
93+
normalized = NormalizePrimoRecord.new(full_record, 'test').normalize
94+
assert_nil normalized[:citation]
95+
end
96+
8997
test 'handles missing citation' do
9098
normalized = NormalizePrimoRecord.new(minimal_record, 'test').normalize
9199
assert_nil normalized[:citation]

0 commit comments

Comments
 (0)