Remove the ordering from the dossier scopes

This commit is contained in:
gregoirenovel 2017-09-27 11:51:31 +02:00
parent b1cfd7e1bc
commit 88ad986143
3 changed files with 13 additions and 13 deletions

View file

@ -35,9 +35,9 @@ class Backoffice::DossiersListController < ApplicationController
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end
default_smart_listing_create :new_dossiers, service.nouveaux
default_smart_listing_create :follow_dossiers, service.suivi
default_smart_listing_create :all_state_dossiers, service.all_state
default_smart_listing_create :new_dossiers, service.nouveaux.order_by_updated_at('asc')
default_smart_listing_create :follow_dossiers, service.suivi.order_by_updated_at('asc')
default_smart_listing_create :all_state_dossiers, service.all_state.order_by_updated_at('asc')
default_smart_listing_create :archived_dossiers, service.archive
@archived_dossiers = service.archive

View file

@ -54,12 +54,12 @@ class Dossier < ActiveRecord::Base
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) }
scope :all_state, -> { not_archived.state_not_brouillon.order_by_updated_at(:asc) }
scope :nouveaux, -> { not_archived.state_nouveaux.order_by_updated_at(:asc) }
scope :en_instruction, -> { not_archived.state_en_instruction.order_by_updated_at(:asc) }
scope :termine, -> { not_archived.state_termine.order_by_updated_at(:asc) }
scope :downloadable, -> { state_not_brouillon.order_by_updated_at(:asc) }
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction.order_by_updated_at(:asc) }
scope :all_state, -> { not_archived.state_not_brouillon }
scope :nouveaux, -> { not_archived.state_nouveaux }
scope :en_instruction, -> { not_archived.state_en_instruction }
scope :termine, -> { not_archived.state_termine }
scope :downloadable, -> { state_not_brouillon }
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
scope :without_followers, -> { includes(:follows).where(follows: { id: nil }) }
scope :with_unread_notifications, -> { where(notifications: { already_read: false }) }

View file

@ -20,7 +20,7 @@ class DossiersListGestionnaireService
end
def all_state
@all_state ||= filter_dossiers.all_state
@all_state ||= filter_dossiers.all_state.order_by_updated_at('asc')
end
def suivi
@ -28,11 +28,11 @@ class DossiersListGestionnaireService
end
def nouveaux
@nouveaux ||= filter_dossiers.nouveaux
@nouveaux ||= filter_dossiers.nouveaux.order_by_updated_at('asc')
end
def a_instruire
@a_instruire ||= filter_dossiers.en_instruction
@a_instruire ||= filter_dossiers.en_instruction.order_by_updated_at('asc')
end
def archive
@ -40,7 +40,7 @@ class DossiersListGestionnaireService
end
def termine
@termine ||= filter_dossiers.termine
@termine ||= filter_dossiers.termine.order_by_updated_at('asc')
end
def filter_dossiers