Update personal_journals_controller.rb

This commit is contained in:
chiu 2019-08-15 08:46:28 +08:00
parent d7862784cd
commit fabd331bdf
1 changed files with 4 additions and 1 deletions

View File

@ -21,6 +21,7 @@ class PersonalJournalsController < ApplicationController
] ]
end end
if params[:selectbox] !=nil if params[:selectbox] !=nil
t = Time.now
journal_papers = JournalPaper.where(:is_hidden=>false) journal_papers = JournalPaper.where(:is_hidden=>false)
journal_papers_count = journal_papers.count 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] } journal_papers_temp = journal_papers.take(journal_papers_count).sort_by{ |tp| [-tp[:year].to_i,-tp[:publication_date].to_i] }
@ -50,6 +51,7 @@ class PersonalJournalsController < ApplicationController
journal_papers_show_last = journal_papers_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count] journal_papers_show_last = journal_papers_show[(page_to_show-1)*OrbitHelper.page_data_count...page_to_show*OrbitHelper.page_data_count]
journal_papers = journal_papers_show_last journal_papers = journal_papers_show_last
journal_papers_total_pages = (journal_papers_show.length/OrbitHelper.page_data_count.to_f).ceil journal_papers_total_pages = (journal_papers_show.length/OrbitHelper.page_data_count.to_f).ceil
timer = Time.now-t
else else
journal_papers_total_pages = journal_papers.total_pages journal_papers_total_pages = journal_papers.total_pages
end end
@ -110,7 +112,8 @@ class PersonalJournalsController < ApplicationController
"search_text" => search_text, "search_text" => search_text,
"search_value" => params[:keywords]}, "search_value" => params[:keywords]},
"total_pages" => journal_papers_total_pages, "total_pages" => journal_papers_total_pages,
"choice" => choice "choice" => choice,
"timer" => timer
} }
end end