amelioration(avis): sur une page listant les avis en attente sur une procedure, on remonte le dernier avis demandé en premier

This commit is contained in:
Martin 2022-11-24 14:23:06 +01:00
parent 2b7d4a81a9
commit bb993d552e
2 changed files with 3 additions and 2 deletions

View file

@ -31,7 +31,7 @@ module Experts
when DONNES_STATUS
@avis_donnes
end
@avis = @avis.by_latest
@avis = @avis.page([params[:page].to_i, 1].max)
end

View file

@ -28,10 +28,11 @@ describe Experts::AvisController, type: :controller do
describe '#procedure' do
context 'without filter' do
let!(:oldest_avis_without_answer) { create(:avis, dossier: dossier, claimant: claimant, experts_procedure: experts_procedure, created_at: 2.years.ago) }
before { get :procedure, params: { procedure_id: procedure.id } }
it { expect(response).to have_http_status(:success) }
it { expect(assigns(:avis_a_donner)).to match([avis_without_answer]) }
it { expect(assigns(:avis_a_donner)).to match([avis_without_answer, oldest_avis_without_answer]) }
it { expect(assigns(:avis_donnes)).to match([avis_with_answer]) }
it { expect(assigns(:statut)).to eq('a-donner') }
end