From 43d889a3d2c1d336109b14c0518e7a82efd7f0ec Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Tue, 19 Mar 2024 07:55:33 -0500 Subject: [PATCH] Remove unnecessary conditional --- app/components/access_panels/library_component.rb | 11 +++-------- lib/holdings/library.rb | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/components/access_panels/library_component.rb b/app/components/access_panels/library_component.rb index 2e6742772..d2851f6e9 100644 --- a/app/components/access_panels/library_component.rb +++ b/app/components/access_panels/library_component.rb @@ -14,14 +14,9 @@ def initialize(library:, document:) end def thumb_for_library - srcset = {} - image_name = if library.zombie? - srcset["#{library.code}@2x.png"] = '2x' - "#{library.code}.png" - else - srcset["#{library.code}@2x.jpg"] = '2x' - "#{library.code}.jpg" - end + suffix = library.zombie? ? 'png' : 'jpg' + srcset = { "#{library.code}@2x.#{suffix}" => '2x' } + image_name = "#{library.code}.#{suffix}" image_tag(image_name, srcset:, class: "pull-left", alt: "", height: 50) rescue Sprockets::Rails::Helper::AssetNotFound => e Honeybadger.notify(e, error_message: "Missing library thumbnail for #{library.code}") diff --git a/lib/holdings/library.rb b/lib/holdings/library.rb index 244853360..96592f1ef 100644 --- a/lib/holdings/library.rb +++ b/lib/holdings/library.rb @@ -57,7 +57,7 @@ def holding_library? end def zombie? - @code == 'ZOMBIE' + @code == 'ZOMBIE' # e.g. a490837, a612226, a448849, in00000060570 end def present?