]> jaekl.net Git - quanlib.git/commitdiff
Clean up some glitches from the RuboCop-cleanup
authorChris Jaekl <chris@localhost>
Sun, 23 Jun 2024 03:07:44 +0000 (23:07 -0400)
committerChris Jaekl <chris@localhost>
Sun, 23 Jun 2024 03:07:44 +0000 (23:07 -0400)
app/book.rb
app/navigator.rb
app/page.rb
app/store.rb

index 3449b6dc76204ac6959fd779bd26e0d24a4d01b3..2bb2c63a5c2f9d5db951030c29ec7f19ba24ed32 100644 (file)
@@ -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)
index df0f4e156aab44255a6741858083cad55e3f6bd0..4503d4dcf5f5be6e89041645b3ffeaa4db211902 100644 (file)
@@ -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
 
index 2d78d0543b0c86c9af40eb22538d2bff6bae5957..6b3bc6986423eca035a7b243ae6d2923476feb18 100644 (file)
@@ -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?
-
-    "<a href=#{data[0].inspect}>#{data[1]}</a>"
-  end
-
-  def write_footer(file_descriptor)
-    file_descriptor.puts "    <p class=\"navigator\">#{navig_back_up_forward}</p>"
-  end
-
-  def write_header(file_descriptor)
-    file_descriptor.puts "    <h1 class=\"header\">#{@title}</h1>"
-
-    file_descriptor.puts "    <p class=\"navigator\">#{navig_back_up_forward}</p>"
-  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?
+
+    "<a href=#{data[0].inspect}>#{data[1]}</a>"
+  end
+
+  def write_footer(file_descriptor)
+    file_descriptor.puts "    <p class=\"navigator\">#{navig_back_up_forward}</p>"
+  end
+
+  def write_header(file_descriptor)
+    file_descriptor.puts "    <h1 class=\"header\">#{@title}</h1>"
+
+    file_descriptor.puts "    <p class=\"navigator\">#{navig_back_up_forward}</p>"
+  end
+
   def write_special(file_descriptor)
     file_descriptor.puts(@special) unless @special.nil?
   end
index e87ca09e015751bce2fdd4d9a6c246fac0a93d7d..611c57f151860d28857c747abd0e355241f64ca7 100644 (file)
@@ -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