From 20d35e716283b3552a69c33f93bf9089af89b78f Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 19 Aug 2019 16:12:47 +0800 Subject: [PATCH] Update personal_books_controller.rb coding style fix --- app/controllers/personal_books_controller.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/personal_books_controller.rb b/app/controllers/personal_books_controller.rb index 0ec3f4f..e5a01d4 100644 --- a/app/controllers/personal_books_controller.rb +++ b/app/controllers/personal_books_controller.rb @@ -1,12 +1,8 @@ class PersonalBooksController < ApplicationController - def search_all_words(target,word) - target=target.upcase - words=word.upcase.split(' ') - return words.select{|value| target.include? value}==words - end def index params = OrbitHelper.params - books = Book.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) + page_data_count = OrbitHelper.page_data_count + books = Book.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(page_data_count) page = Page.where(:page_id => params[:page_id]).first rescue nil if page.custom_string_field == "table" @@ -53,8 +49,8 @@ class PersonalBooksController < ApplicationController else page_to_show = params[:page_no].to_i end - books = books_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count] - books_total_pages = (books_show.length/OrbitHelper.page_data_count.to_f).ceil + books = books_show[(page_to_show-1)page_data_count...page_to_show*page_data_count] + books_total_pages = (books_show.length/page_data_count.to_f).ceil else books_total_pages = books.total_pages end @@ -179,4 +175,10 @@ class PersonalBooksController < ApplicationController page.save render :json => {"success" => true}.to_json end +private + def search_all_words(target,word) + target=target.upcase + words=word.upcase.split(' ') + return words.select{|value| target.include? value}==words + end end