From 1d60d68aed4e609af7d51c73aaf408b22e4c73ed Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 15 Aug 2019 10:25:06 +0800 Subject: [PATCH] =?UTF-8?q?Update=20personal=5Fconferences=5Fcontroller.rb?= =?UTF-8?q?=20=E5=88=AA=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/personal_conferences_controller.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/controllers/personal_conferences_controller.rb b/app/controllers/personal_conferences_controller.rb index 2043c41..bae5aa4 100644 --- a/app/controllers/personal_conferences_controller.rb +++ b/app/controllers/personal_conferences_controller.rb @@ -25,9 +25,7 @@ class PersonalConferencesController < ApplicationController ] end if params[:selectbox] !=nil - writing_conferences = WritingConference.where(:is_hidden=>false) - writing_conferences_count = writing_conferences.count - writing_conferences_temp = writing_conferences.take(writing_conferences_count).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] } + writing_conferences_temp = WritingConference.where(:is_hidden=>false).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] } case params[:selectbox] when "paper_title","default" if page.custom_string_field == "table" @@ -42,7 +40,7 @@ class PersonalConferencesController < ApplicationController when "period" writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.duration, params[:keywords])} when "publication_date" - writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.send("publication_date").strftime("%Y/%m").collect{|x| x.title}.join(', '), params[:keywords])} + writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.send("publication_date").strftime("%Y/%m/%d").collect{|x| x.title}.join(', '), params[:keywords])} when "author_type" writing_conferences_show = writing_conferences_temp.select {|value| search_all_words(value.conference_author_types.collect{|cat| cat.title}.join(", "), params[:keywords])} when "language" @@ -55,8 +53,7 @@ class PersonalConferencesController < ApplicationController else page_to_show = params[:page_no].to_i end - writing_conferences_show_last = writing_conferences_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count] - writing_conferences = writing_conferences_show_last + writing_conferences = writing_conferences_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count] writing_conferences_total_pages = (writing_conferences_show.length/OrbitHelper.page_data_count.to_f).ceil else writing_conferences_total_pages = writing_conferences.total_pages