Skip to content

Commit

Permalink
fix order for user's dossiers page
Browse files Browse the repository at this point in the history
  • Loading branch information
krichtof committed Feb 5, 2025
1 parent 54b5401 commit a3246c6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/users/dossiers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DossiersController < UserController
end

def index
ordered_dossiers = Dossier.includes(:procedure).order_by_updated_at
ordered_dossiers = Dossier.includes(:procedure).order_by_depose_at

user_revisions = ProcedureRevision.where(dossiers: current_user.dossiers.visible_by_user)
invite_revisions = ProcedureRevision.where(dossiers: current_user.dossiers_invites.visible_by_user)
Expand Down
1 change: 1 addition & 0 deletions app/models/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def classer_sans_suite(motivation: nil, instructeur: nil, processed_at: Time.zon
scope :for_editing_fork, -> { where.not(editing_fork_origin_id: nil) }
scope :for_groupe_instructeur, -> (groupe_instructeurs) { where(groupe_instructeur: groupe_instructeurs) }
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order, id: order) }
scope :order_by_depose_at, -> (order = :desc) { order(depose_at: order, id: order) }
scope :order_by_created_at, -> (order = :asc) { order(depose_at: order, id: order) }
scope :updated_since, -> (since) { where(dossiers: { updated_at: since.. }) }
scope :created_since, -> (since) { where(dossiers: { depose_at: since.. }) }
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/dossiers/_dossiers_list.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
= page_entries_info dossiers

- dossiers.each do |dossier|
.card
.card{ id: "dossier_#{dossier.id}" }
.flex.justify-between
%div
%h3.card-title
Expand Down
2 changes: 1 addition & 1 deletion spec/system/users/list_dossiers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
context 'when user clicks on delete button' do
scenario 'the dossier is deleted' do
expect(page).to have_content(dossier_en_construction.procedure.libelle)
within(:css, ".card", match: :first) do
within(:css, "#dossier_#{dossier_en_construction.id}", match: :first) do
click_on 'Autres actions'
accept_alert('Confirmer la suppression ?') do
click_on 'Mettre à la corbeille'
Expand Down

0 comments on commit a3246c6

Please sign in to comment.