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
36 changes: 18 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ GEM
benchmark (0.5.0)
bigdecimal (4.0.1)
bindex (0.8.1)
bootsnap (1.21.1)
bootsnap (1.22.0)
msgpack (~> 1.2)
bootstrap_form (5.5.0)
bootstrap_form (5.6.0)
actionpack (>= 7.2)
activemodel (>= 7.2)
brakeman (7.1.2)
brakeman (8.0.1)
racc
builder (3.3.0)
bundler-audit (0.9.3)
Expand Down Expand Up @@ -209,16 +209,16 @@ GEM
groupdate (6.7.0)
activesupport (>= 7.1)
hashdiff (1.2.1)
herb (0.8.8-aarch64-linux-gnu)
herb (0.8.8-aarch64-linux-musl)
herb (0.8.8-arm-linux-gnu)
herb (0.8.8-arm-linux-musl)
herb (0.8.8-arm64-darwin)
herb (0.8.8-x86_64-linux-gnu)
herb (0.8.8-x86_64-linux-musl)
herb (0.8.9-aarch64-linux-gnu)
herb (0.8.9-aarch64-linux-musl)
herb (0.8.9-arm-linux-gnu)
herb (0.8.9-arm-linux-musl)
herb (0.8.9-arm64-darwin)
herb (0.8.9-x86_64-linux-gnu)
herb (0.8.9-x86_64-linux-musl)
highline (3.1.2)
reline
honeybadger (6.2.1)
honeybadger (6.3.0)
logger
ostruct
http (5.3.1)
Expand Down Expand Up @@ -290,7 +290,7 @@ GEM
net-imap
net-pop
net-smtp
marc (1.3.0)
marc (1.4.0)
nokogiri (~> 1.0)
rexml
marcel (1.1.0)
Expand Down Expand Up @@ -360,7 +360,7 @@ GEM
pp (0.6.3)
prettyprint
prettyprint (0.2.0)
prism (1.8.0)
prism (1.9.0)
propshaft (1.3.1)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
Expand Down Expand Up @@ -456,16 +456,16 @@ GEM
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.6)
rubocop (1.82.1)
rspec-support (3.13.7)
rubocop (1.84.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.48.0, < 2.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
Expand Down Expand Up @@ -545,7 +545,7 @@ GEM
timecop (0.9.10)
timeout (0.6.0)
tsort (0.2.0)
turbo-rails (2.0.21)
turbo-rails (2.0.23)
actionpack (>= 7.1.0)
railties (>= 7.1.0)
tzinfo (2.0.6)
Expand Down Expand Up @@ -665,4 +665,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
4.0.4
4.0.5
31 changes: 15 additions & 16 deletions app/services/marc_record_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,24 +215,23 @@ def reader(io)
def each_with_metadata_for_marc21
return to_enum(:each_with_metadata_for_marc21) unless block_given?

each_raw_record_with_metadata_for_marc21
.slice_when { |i, j| !same_record?(i[:marc], j[:marc]) }
.with_index do |records_to_combine, index|
if records_to_combine.length == 1
yield(records_to_combine.first[:marc], records_to_combine.first.except(:marc))
else
bytes = records_to_combine.pluck(:marc_bytes).join
each_raw_record_with_metadata_for_marc21.slice_when { |i, j| !same_record?(i[:marc], j[:marc]) }
.with_index do |records_to_combine, index|
if records_to_combine.length == 1
yield(records_to_combine.first[:marc], records_to_combine.first.except(:marc))
else
bytes = records_to_combine.pluck(:marc_bytes).join

record = merge_records(*records_to_combine.pluck(:marc))
record = merge_records(*records_to_combine.pluck(:marc))

yield record, {
**records_to_combine.first.except(:marc, :marc_bytes),
index: index,
bytecount: bytes.length,
length: bytes.length,
checksum: Digest::MD5.hexdigest(bytes)
}
end
yield record, {
**records_to_combine.first.except(:marc, :marc_bytes),
index: index,
bytecount: bytes.length,
length: bytes.length,
checksum: Digest::MD5.hexdigest(bytes)
}
end
end
end

Expand Down