Remove archived=false filter from en_construction scope (Fix : archived dossier is not shown to user)
This commit is contained in:
parent
688a3d8f31
commit
7a9fd77af0
7 changed files with 27 additions and 15 deletions
|
@ -18,7 +18,7 @@ class Users::DossiersController < UsersController
|
|||
when 'brouillon'
|
||||
@user_dossiers.brouillon.order_by_updated_at
|
||||
when 'a_traiter'
|
||||
@user_dossiers.en_construction
|
||||
@user_dossiers.en_construction.order_by_updated_at
|
||||
when 'en_instruction'
|
||||
@user_dossiers.en_instruction
|
||||
when 'termine'
|
||||
|
|
|
@ -181,7 +181,7 @@ class Dossier < ActiveRecord::Base
|
|||
where(state: WAITING_FOR_USER, archived: false).order("updated_at #{order}")
|
||||
end
|
||||
|
||||
scope :en_construction, -> { where(state: EN_CONSTRUCTION, archived: false).order(updated_at: :asc) }
|
||||
scope :en_construction, -> { where(state: EN_CONSTRUCTION) }
|
||||
|
||||
def self.ouvert order = 'ASC'
|
||||
where(state: OUVERT, archived: false).order("updated_at #{order}")
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#procedure-list
|
||||
- unless current_user.dossiers.count == 0
|
||||
%a{ :href => "#{url_for users_dossiers_path(liste: 'brouillon')}", 'data-toggle' => :tooltip, title: 'Les dossiers jamais proposés à la relecture.' }
|
||||
.procedure_list_element{ class: ('active' if @liste == 'brouillon'), id: 'brouillon' }
|
||||
.procedure-list-element{ class: ('active' if @liste == 'brouillon'), id: 'brouillon' }
|
||||
Brouillons
|
||||
.badge.progress-bar-default
|
||||
= @user_dossiers.brouillon.count
|
||||
|
@ -24,19 +24,19 @@
|
|||
= @user_dossiers.en_construction.count
|
||||
|
||||
%a{ :href => "#{url_for users_dossiers_path(liste: 'en_instruction')}", 'data-toggle' => :tooltip, title: 'Les dossiers en cours d\'examen par l\'administration compétante.' }
|
||||
.procedure_list_element{ class: ('active' if @liste == 'en_instruction'), id: 'en_instruction' }
|
||||
.procedure-list-element{ class: ('active' if @liste == 'en_instruction'), id: 'en_instruction' }
|
||||
En instruction
|
||||
.badge.progress-bar-default
|
||||
= @user_dossiers.en_instruction.count
|
||||
|
||||
%a{ :href => "#{url_for users_dossiers_path(liste: 'termine')}", 'data-toggle' => :tooltip, title: 'Les dossiers cloturés qui peuvent être "Accepté", "Refusé" ou "Sans suite".' }
|
||||
.procedure_list_element{ class: ('active' if @liste == 'termine'), id: 'termine' }
|
||||
.procedure-list-element{ class: ('active' if @liste == 'termine'), id: 'termine' }
|
||||
Terminé
|
||||
.badge.progress-bar-success
|
||||
= @user_dossiers.termine.count
|
||||
|
||||
%a{ :href => "#{url_for users_dossiers_path(liste: 'invite')}" }
|
||||
.procedure_list_element{ class: ('active' if @liste == 'invite'), id: 'invite' }
|
||||
.procedure-list-element{ class: ('active' if @liste == 'invite'), id: 'invite' }
|
||||
Invitation
|
||||
.badge.progress-bar-warning
|
||||
= current_user.invites.count
|
||||
|
|
|
@ -47,6 +47,14 @@ FactoryGirl.define do
|
|||
end
|
||||
end
|
||||
|
||||
trait :archived do
|
||||
archived true
|
||||
end
|
||||
|
||||
trait :not_archived do
|
||||
archived false
|
||||
end
|
||||
|
||||
trait :replied do
|
||||
state 'replied'
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ FactoryGirl.define do
|
|||
sequence(:published_path) { |n| "fake_path#{n}" }
|
||||
factory :procedure do
|
||||
lien_demarche 'http://localhost'
|
||||
libelle 'Demande de subvention'
|
||||
sequence(:libelle) { |n| "Procedure #{n}" }
|
||||
description "Demande de subvention à l'intention des associations"
|
||||
organisation "Orga SGMAP"
|
||||
direction "direction SGMAP"
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'user access to the list of his dossier' do
|
||||
describe 'user access to the list of his dossier' do
|
||||
let(:user) { create(:user) }
|
||||
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'replied')}
|
||||
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'replied') }
|
||||
let!(:dossier2) { create(:dossier, :with_entreprise) }
|
||||
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'replied') }
|
||||
|
||||
before do
|
||||
dossier1.update_column(:updated_at, "19/07/2052 15:35".to_time)
|
||||
dossier1.procedure.update_column(:libelle, 'PLOP')
|
||||
last_updated_dossier.procedure.update_column(:libelle, 'PLIP')
|
||||
last_updated_dossier.update_column(:updated_at, "19/07/2052 15:35".to_time)
|
||||
|
||||
visit new_user_session_path
|
||||
within('#new-user') do
|
||||
|
@ -18,16 +17,21 @@ feature 'user access to the list of his dossier' do
|
|||
page.click_on 'Se connecter'
|
||||
end
|
||||
end
|
||||
scenario 'the list of dossier is displayed' do
|
||||
|
||||
it 'the list of dossier is displayed' do
|
||||
expect(page).to have_content(dossier1.procedure.libelle)
|
||||
expect(page).not_to have_content(dossier2.procedure.libelle)
|
||||
end
|
||||
|
||||
scenario 'the list must be order by last updated' do
|
||||
it 'the list must be order by last updated' do
|
||||
expect(page.body).to match(/#{last_updated_dossier.procedure.libelle}.*#{dossier1.procedure.libelle}/m)
|
||||
end
|
||||
|
||||
scenario 'the state of dossier is displayed' do
|
||||
it 'should list archived dossier' do
|
||||
expect(page).to have_content(dossier_archived.procedure.libelle)
|
||||
end
|
||||
|
||||
it 'the state of dossier is displayed' do
|
||||
expect(page).to have_css("#dossier_#{dossier1.id}_state")
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe MailTemplateConcern do
|
|||
it 'works' do
|
||||
initiated_mail.object = '[TPS] --numero_dossier-- --libelle_procedure-- --lien_dossier--'
|
||||
expected =
|
||||
"[TPS] #{dossier.id} Demande de subvention " +
|
||||
"[TPS] #{dossier.id} #{dossier.procedure.libelle} " +
|
||||
"<a target=\"_blank\" href=\"http://localhost:3000/users/dossiers/#{dossier.id}/recapitulatif\">http://localhost:3000/users/dossiers/#{dossier.id}/recapitulatif</a>"
|
||||
|
||||
expect(initiated_mail.object_for_dossier(dossier)).to eq(expected)
|
||||
|
|
Loading…
Reference in a new issue