Update sort.
This commit is contained in:
parent
a3d760bddf
commit
bde0a0df50
|
@ -31,7 +31,7 @@ class Admin::WritingConferencesController < OrbitMemberController
|
||||||
redirect_to :action=> 'index'
|
redirect_to :action=> 'index'
|
||||||
end
|
end
|
||||||
def merge
|
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|
|
@writing_conferences.each do |key,value|
|
||||||
if value.length<=1
|
if value.length<=1
|
||||||
@writing_conferences.delete key
|
@writing_conferences.delete key
|
||||||
|
@ -54,7 +54,7 @@ class Admin::WritingConferencesController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
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
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -3,7 +3,7 @@ class PersonalConferencesController < ApplicationController
|
||||||
def index
|
def index
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
page_data_count = OrbitHelper.page_data_count
|
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
|
page = Page.where(page_id: params[:page_id]).first rescue nil
|
||||||
if page.custom_string_field == 'table'
|
if page.custom_string_field == 'table'
|
||||||
fields_to_show = page.custom_array_field rescue []
|
fields_to_show = page.custom_array_field rescue []
|
||||||
|
|
|
@ -40,7 +40,9 @@ class WritingConference
|
||||||
|
|
||||||
before_validation :add_http
|
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
|
def create_link
|
||||||
title = []
|
title = []
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if has_access?
|
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
|
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
|
end
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue