Update sort.
This commit is contained in:
parent
a3d760bddf
commit
bde0a0df50
|
@ -31,7 +31,7 @@ class Admin::WritingConferencesController < OrbitMemberController
|
|||
redirect_to :action=> 'index'
|
||||
end
|
||||
def merge
|
||||
@writing_conferences=WritingConference.order_by(:year=>'desc').map{|value| value}.group_by{|v| [v[:paper_title],v[:conference_title]]}
|
||||
@writing_conferences=WritingConference.sort_year_date.map{|value| value}.group_by{|v| [v[:paper_title],v[:conference_title]]}
|
||||
@writing_conferences.each do |key,value|
|
||||
if value.length<=1
|
||||
@writing_conferences.delete key
|
||||
|
@ -54,7 +54,7 @@ class Admin::WritingConferencesController < OrbitMemberController
|
|||
end
|
||||
|
||||
def index
|
||||
@writing_conferences = WritingConference.order_by(:year=>'desc').page(params[:page]).per(10)
|
||||
@writing_conferences = WritingConference.sort_year_date.page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -3,7 +3,7 @@ class PersonalConferencesController < ApplicationController
|
|||
def index
|
||||
params = OrbitHelper.params
|
||||
page_data_count = OrbitHelper.page_data_count
|
||||
writing_conferences = WritingConference.where(is_hidden: false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(page_data_count)
|
||||
writing_conferences = WritingConference.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'
|
||||
fields_to_show = page.custom_array_field rescue []
|
||||
|
|
|
@ -40,7 +40,9 @@ class WritingConference
|
|||
|
||||
before_validation :add_http
|
||||
|
||||
scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year => "desc", :publication_date => "desc", :period_start_date => "desc") }
|
||||
index({year: -1, publication_date: -1, period_start_date: -1, _id: -1}, { unique: false, background: false })
|
||||
scope :sort_year_date, ->{ order_by(:year => "desc", :publication_date => "desc", :period_start_date => "desc", :id => "desc") }
|
||||
scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year => "desc", :publication_date => "desc", :period_start_date => "desc", :id => "desc") }
|
||||
|
||||
def create_link
|
||||
title = []
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
<%
|
||||
if has_access?
|
||||
@writing_conferences = WritingConference.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||
@writing_conferences = WritingConference.where(member_profile_id: @member.id).sort_year_date.page(params[:page]).per(10)
|
||||
else
|
||||
@writing_conferences = WritingConference.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
||||
@writing_conferences = WritingConference.where(is_hidden: false, member_profile_id: @member.id).sort_year_date.page(params[:page]).per(10)
|
||||
end
|
||||
%>
|
||||
|
||||
|
|
Loading…
Reference in New Issue