From 959451f9d4862c43b0fe9a7b27f302ace982f7a4 Mon Sep 17 00:00:00 2001 From: Chris Jaekl Date: Sat, 22 Jun 2024 23:07:44 -0400 Subject: [PATCH] Clean up some glitches from the RuboCop-cleanup --- app/book.rb | 10 +++++----- app/navigator.rb | 2 +- app/page.rb | 44 ++++++++++++++++++++++---------------------- app/store.rb | 1 + 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/app/book.rb b/app/book.rb index 3449b6d..2bb2c63 100644 --- a/app/book.rb +++ b/app/book.rb @@ -191,7 +191,7 @@ class Book # TODO: Fix horrible hard-coded strings and paths return unless category == "00_nonFic" && classification_id.nil? - File.open(Store.unclassified_csv, "a") do |fd| + File.open(@store.unclassified_csv, "a") do |fd| fd.puts "#{grouping.inspect},#{path.inspect}" end end @@ -209,11 +209,11 @@ class Book opf_path = cont_doc.css("container rootfiles rootfile")[0]["full-path"] scan_opf!(zipfile, opf_path) - rescue Zip::Error => e - puts "ERROR processing file #{file_name.inspect}:" - puts e.message - puts e.backtrace end + rescue Zip::Error => e + puts "ERROR processing file #{file_name.inspect}:" + puts e.message + puts e.backtrace end def scan_pdf!(file_name) diff --git a/app/navigator.rb b/app/navigator.rb index df0f4e1..4503d4d 100644 --- a/app/navigator.rb +++ b/app/navigator.rb @@ -71,7 +71,7 @@ class Navigator series_infos.push([series, book_ids]) unless book_ids&.empty? end - 0..(series_infos.length - 1).each do |idx| + (0..(series_infos.length - 1)).each do |idx| back = nil fwd = nil diff --git a/app/page.rb b/app/page.rb index 2d78d05..6b3bc69 100644 --- a/app/page.rb +++ b/app/page.rb @@ -45,28 +45,6 @@ class Page end end - private - - def navig_back_up_forward - [navig_link(@back), navig_link(@up), navig_link(@forward)].join(" ") - end - - def navig_link(data) - return "" if data.nil? - - "#{data[1]}" - end - - def write_footer(file_descriptor) - file_descriptor.puts "

#{navig_back_up_forward}

" - end - - def write_header(file_descriptor) - file_descriptor.puts "

#{@title}

" - - file_descriptor.puts "

#{navig_back_up_forward}

" - end - def write_html(book_ids) FileUtils.mkdir_p(@output_dir) unless Dir.exist?(@output_dir) @@ -93,6 +71,28 @@ class Page end end + private + + def navig_back_up_forward + [navig_link(@back), navig_link(@up), navig_link(@forward)].join(" ") + end + + def navig_link(data) + return "" if data.nil? + + "#{data[1]}" + end + + def write_footer(file_descriptor) + file_descriptor.puts "

#{navig_back_up_forward}

" + end + + def write_header(file_descriptor) + file_descriptor.puts "

#{@title}

" + + file_descriptor.puts "

#{navig_back_up_forward}

" + end + def write_special(file_descriptor) file_descriptor.puts(@special) unless @special.nil? end diff --git a/app/store.rb b/app/store.rb index e87ca09..611c57f 100644 --- a/app/store.rb +++ b/app/store.rb @@ -626,6 +626,7 @@ class Store def query_books_by_series_id(id) sql = <<~SQL + SELECT b.id FROM Books b WHERE b.series = $1 ORDER BY b.volume,b.title SQL -- 2.39.2