]> jaekl.net Git - quanlib.git/commitdiff
Clean up indendation and unused variables
authorChris Jaekl <chris@jaekl.net>
Thu, 20 Jun 2024 15:45:02 +0000 (11:45 -0400)
committerChris Jaekl <chris@jaekl.net>
Thu, 20 Jun 2024 15:45:02 +0000 (11:45 -0400)
app/book.rb
app/store.rb

index 2b93f4b574c9c45738a3a95a2c0b4f1697083d1c..8c41067a2159c366642a0d2d5cbb70f6cde127ab 100644 (file)
@@ -153,7 +153,7 @@ class Book
     input.each_char do |c|
       if isUpper?(c) and (reading_order.length > 0)
         reading_order += " "
-     end
+      end
       reading_order += c
     end
 
@@ -173,7 +173,7 @@ class Book
     vol = nil
 
     first = arr[0]
-    matchData = (arr[0]).match(@@SERIES_AND_VOLUME_REGEX)
+    matchData = (first).match(@@SERIES_AND_VOLUME_REGEX)
     if nil != matchData
       capt = matchData.captures
       series = capt[0]
@@ -372,7 +372,6 @@ class Book
 
   protected
   def load_cover(zipfile, opfPath, opfDoc, coverId)
-    coverFile = nil
     if nil == coverId
       coverId = "cover-image"
     end
@@ -392,7 +391,7 @@ class Book
           # wild have been found to use a bath relative to the location
           # of the opf file.
           parts = opfPath.split('/')
-          opfBasePath = opfPath.split('/')[0..-2].join('/')
+          opfBasePath = parts[0..-2].join('/')
           coverPath = opfBasePath + '/' + href
           entry = zipfile.find_entry(coverPath)
         end
index 1a33ca3868340e0cadf9f770d0e1517a3a57711d..843d01b14f3b620f874bd882dceeeb24923e963b 100644 (file)
@@ -327,7 +327,7 @@ EOS
     book_id = next_id('book_id')
 
     author_id = store_author(book.author)
-    (efs_id, mime_type) = store_cover(book)
+    efs_id = store_cover(book)&.first
 
     args = [book_id, book.arrived, author_id, book.classification_id, efs_id, book.description, book.language, book.path, book.series_id, book.title, book.volume]
 
@@ -420,7 +420,7 @@ EOS
 
     FileUtils.mkdir_p(efspath)
 
-    (filepath, mimetype) = cover.write_image(efspath, efsname)
+    mimetype = cover.write_image(efspath, efsname)&.last
 
     sql = "INSERT INTO efs VALUES ($1, $2)"
     begin