Update personal_journals_controller.rb

This commit is contained in:
chiu 2019-08-15 08:51:19 +08:00
parent dd492dfc9d
commit f1e57a93ab
1 changed files with 2 additions and 2 deletions

View File

@ -21,10 +21,10 @@ class PersonalJournalsController < ApplicationController
]
end
if params[:selectbox] !=nil
t = Time.now
journal_papers = JournalPaper.where(:is_hidden=>false)
journal_papers_count = journal_papers.count
journal_papers_temp = journal_papers.take(journal_papers_count).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] }
t = Time.now
case params[:selectbox]
when "paper_title","default"
if page.custom_string_field == "table"
@ -43,6 +43,7 @@ class PersonalJournalsController < ApplicationController
else
journal_papers_show = journal_papers_temp.select {|value| value.send(params[:selectbox]).to_s.upcase.include? params[:keywords].upcase}
end
timer = Time.now-t
if params[:page_no].nil?
page_to_show = 1
else
@ -50,7 +51,6 @@ class PersonalJournalsController < ApplicationController
end
journal_papers = journal_papers_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
journal_papers_total_pages = (journal_papers_show.length/OrbitHelper.page_data_count.to_f).ceil
timer = Time.now-t
else
journal_papers_total_pages = journal_papers.total_pages
end