Skip to content

Commit

Permalink
update simple-spreadsheet-extractor gem to fix #1728
Browse files Browse the repository at this point in the history
includes updated javacode, and error handling in the gem, to ensure any errors are logged to stderr rather than stdout, and therefore prevent uncritical errors appearing the successful output
  • Loading branch information
stuzart committed Feb 2, 2024
1 parent 2a462b4 commit 3b45e1f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gem 'hpricot', '~>0.8.2'
gem 'libxml-ruby', '~>2.9.0', require: 'libxml'
gem 'uuid', '~>2.3'
gem 'RedCloth', '>=4.3.0'
gem 'simple-spreadsheet-extractor', '~> 0.18.0'
gem 'simple-spreadsheet-extractor', '0.18.1'
gem 'open4'
gem 'sample-template-generator', '~>0.7'
gem 'rmagick', '4.2.5'
Expand Down
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ GEM
citeproc-ruby (2.0.0)
citeproc (~> 1.0, >= 1.0.9)
csl (~> 2.0)
climate_control (0.2.0)
climate_control (1.2.0)
code_analyzer (0.5.5)
sexp_processor
coderay (1.1.3)
Expand Down Expand Up @@ -774,9 +774,9 @@ GEM
rubyntlm (0.6.3)
rubyzip (2.0.0)
rugged (1.1.0)
sample-template-generator (0.7.0)
sample-template-generator (0.7.1)
rdoc (~> 6.0)
terrapin (~> 0.6)
terrapin (~> 1.0)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
Expand Down Expand Up @@ -821,9 +821,9 @@ GEM
rdf-xsd (~> 3.2)
sparql (~> 3.2)
sxp (~> 1.2)
simple-spreadsheet-extractor (0.18.0)
simple-spreadsheet-extractor (0.18.1)
libxml-ruby (~> 2.9)
terrapin (~> 0.6)
terrapin (~> 1.0)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -875,8 +875,8 @@ GEM
teaspoon-mocha (2.3.3)
teaspoon (>= 1.0.0)
temple (0.8.2)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
terrapin (1.0.1)
climate_control
terser (1.1.8)
execjs (>= 0.3.0, < 3)
test-prof (1.0.7)
Expand Down Expand Up @@ -1073,7 +1073,7 @@ DEPENDENCIES
sass-rails (>= 6)
savon (= 1.1.0)
seedbank
simple-spreadsheet-extractor (~> 0.18.0)
simple-spreadsheet-extractor (= 0.18.1)
simplecov
sprockets-rails
sqlite3 (~> 1.4)
Expand Down
6 changes: 6 additions & 0 deletions test/factories/content_blobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,12 @@
content_type { 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }
data { File.new("#{Rails.root}/test/fixtures/files/blank-master-template.xlsx", 'rb').read }
end

factory(:spreadsheet_with_error_logs_content_blob, parent: :content_blob) do
original_filename { 'spreadsheet-with-poi-error-logs.xlsx' }
content_type { 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }
data { File.new("#{Rails.root}/test/fixtures/files/spreadsheet-with-poi-error-logs.xlsx", 'rb').read }
end

factory(:blank_content_blob, class: ContentBlob) do
url { nil }
Expand Down
4 changes: 4 additions & 0 deletions test/factories/data_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@
factory(:small_test_spreadsheet_datafile, parent: :data_file) do
association :content_blob, factory: :small_test_spreadsheet_content_blob
end

factory(:spreadsheet_with_error_logs_datafile, parent: :data_file) do
association :content_blob, factory: :spreadsheet_with_error_logs_content_blob
end

factory(:strain_sample_data_file, parent: :data_file) do
association :content_blob, factory: :strain_sample_data_content_blob
Expand Down
Binary file not shown.
7 changes: 7 additions & 0 deletions test/functional/data_files_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,13 @@ def test_show_item_attributed_to_jerm_file
assert_response :success
end

test 'explore spreadsheet with error logs' do
data = FactoryBot.create :spreadsheet_with_error_logs_datafile, policy: FactoryBot.create(:public_policy)
get :explore, params: { id: data }
assert_response :success
assert_select 'div#spreadsheet_1 table.sheet td#cell_B4',text:'ProjectDescription'
end

test 'explore earlier version' do

df = FactoryBot.create(:small_test_spreadsheet_datafile)
Expand Down

0 comments on commit 3b45e1f

Please sign in to comment.