Update personal_conferences_controller.rb

刪除不必要的字
This commit is contained in:
chiu 2019-08-15 10:25:06 +08:00
parent 7b52a160a2
commit 1d60d68aed
1 changed files with 3 additions and 6 deletions

View File

@ -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