Viewに一覧検索用のカラムを追加
authorOHASHI, Norikazu <katz@neko-mori.sakura.ne.jp>
Thu, 17 Jun 2021 22:19:01 +0000 (07:19 +0900)
committerOHASHI, Norikazu <katz@neko-mori.sakura.ne.jp>
Thu, 17 Jun 2021 22:19:01 +0000 (07:19 +0900)
create_table.sql
sinatra/.rubocop.yml
sinatra/app/views/book_list.haml
sinatra/start.rb
sinatra/unicorn.rb

index ce9606b..bc84b85 100644 (file)
@@ -43,10 +43,13 @@ CREATE TABLE book_covers (
        create_at DATETIME NOT NULL,
        update_at DATETIME NOT NULL);
 
-CREATE VIEW book_fulls (isbn, title, volume, author, publisher, pubdate,
-            user_id, cover_uri) AS
+CREATE VIEW book_fulls (isbn, title, volume, author, publisher,
+            original_author, illustrator, translator, supervisor,
+            pubdate, series, user_id, cover_uri) AS
        SELECT B.isbn AS isbn, B.title AS title, B.volume AS volume,
-       B.author AS author, B.publisher AS publisher, B.pubdate AS pubdate,
-       C.user_id AS user_id, B.cover_uri AS cover_uri
-       FROM (books AS  B left join book_collections AS C
-            ON((B.isbn = C.isbn)));
+       B.author AS author, B.publisher AS publisher,
+       B.original_author AS original_author, B.illustrator AS illustrator,
+       B.translator AS translator, B.supervisor AS supervisor,
+       B.pubdate AS pubdate,B.series AS series, C.user_id AS user_id,
+       B.cover_uri AS cover_uri
+       FROM (books AS  B left join book_collections AS C ON((B.isbn = C.isbn)));
index f7618a2..01274a4 100644 (file)
@@ -34,3 +34,9 @@ Metrics/CyclomaticComplexity:
   Max: 10
 Metrics/PerceivedComplexity:
   Max: 10
+Style/TrailingCommaInArguments:
+  EnforcedStyleForMultiline: comma
+Style/TrailingCommaInArrayLiteral:
+  EnforcedStyleForMultiline: comma
+Style/TrailingCommaInHashLiteral:
+  EnforcedStyleForMultiline: comma
index 45ce5ab..65e58ad 100644 (file)
@@ -99,8 +99,8 @@
             - author = book[:author]
           - else
             - author = ""
-            - if !book[:original_author].nil? and !book[:orignal_author].empty?
-              - author += "原作:#{book[:oritnal_author]} "
+            - if !book[:original_author].nil? and !book[:original_author].empty?
+              - author += "原作:#{book[:original_author]} "
             - if !book[:illustrator].nil? and !book[:illustrator].empty?
               - author += "作画:#{book[:illustrator]} "
           %tr
index 2bc6d19..0ee42ce 100644 (file)
@@ -1,4 +1,6 @@
 # coding: utf-8
+# frozen_string_literal: true
+
 # 書籍管理サーバベース処理
 # @author OHASHI, Norikazu
 
@@ -9,11 +11,11 @@ require_relative './app/controllers/web_gui'
 
 # 書籍サーバ用メインルート
 class Main < Sinatra::Base
-  #ルートに対応するコントローラの指定
+  # ルートに対応するコントローラの指定
   ROUTES = {
     # Web GUI 用のRoute
     '/' => WebGui,
     # Web API 用のRoute
     # '/webapi' => RESTfulAPI,
-  }
+  }.freeze
 end
index d3eb6f5..6139b8c 100644 (file)
@@ -1,4 +1,6 @@
 # coding: utf-8
+# frozen_string_literal: true
+
 require 'fileutils'
 
 @dir = File.dirname(__FILE__)
@@ -9,12 +11,13 @@ working_directory @dir
 timeout 300
 listen 8080
 
-@pid_path = File.join(@dir, "tmp/pids")
+@pid_path = File.join(@dir, 'tmp/pids')
 FileUtils.mkdir_p(@pid_path)
-pid File.join(@pid_path, "unicorn.pid") #pidを保存するファイル
+pid File.join(@pid_path, 'unicorn.pid') # pidを保存するファイル
 
-@log_path = File.join(@dir, "log")
+@log_path = File.join(@dir, 'log')
 FileUtils.mkdir_p(@log_path)
+
 # unicornは標準出力には何も吐かないのでログ出力を忘れずに
-stderr_path File.join(@log_path,"unicorn.stderr.log")
-stdout_path File.join(@log_path,"unicorn.stdout.log")
+stderr_path File.join(@log_path, 'unicorn.stderr.log')
+stdout_path File.join(@log_path, 'unicorn.stdout.log')