REFACTOR : Change dossier state 'Deposited' To 'SubmitValidated'
This commit is contained in:
parent
da8c166331
commit
76d87c7f79
14 changed files with 40 additions and 35 deletions
|
@ -25,10 +25,10 @@ class Users::RecapitulatifController < UsersController
|
||||||
render 'show'
|
render 'show'
|
||||||
end
|
end
|
||||||
|
|
||||||
def depose
|
def submit_validate
|
||||||
show
|
show
|
||||||
|
|
||||||
@dossier.next_step! 'user', 'depose'
|
@dossier.next_step! 'user', 'submit_validate'
|
||||||
flash.notice = 'Dossier déposé avec succès.'
|
flash.notice = 'Dossier déposé avec succès.'
|
||||||
|
|
||||||
render 'show'
|
render 'show'
|
||||||
|
|
|
@ -23,7 +23,7 @@ class DossierDecorator < Draper::Decorator
|
||||||
'Mis à jour'
|
'Mis à jour'
|
||||||
when 'validated'
|
when 'validated'
|
||||||
'Validé'
|
'Validé'
|
||||||
when 'deposited'
|
when 'submit_validated'
|
||||||
'Déposé'
|
'Déposé'
|
||||||
when 'processed'
|
when 'processed'
|
||||||
'Traité'
|
'Traité'
|
||||||
|
|
|
@ -3,8 +3,8 @@ class Dossier < ActiveRecord::Base
|
||||||
submitted: 'submitted',
|
submitted: 'submitted',
|
||||||
replied: 'replied',
|
replied: 'replied',
|
||||||
updated: 'updated',
|
updated: 'updated',
|
||||||
validated: 'validated', #-confirmed
|
validated: 'validated',
|
||||||
deposited: 'deposited', #submit_validated
|
submit_validated: 'submit_validated', #deposited
|
||||||
processed: 'processed'} #closed
|
processed: 'processed'} #closed
|
||||||
|
|
||||||
has_one :etablissement, dependent: :destroy
|
has_one :etablissement, dependent: :destroy
|
||||||
|
@ -49,7 +49,7 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_step! role, action
|
def next_step! role, action
|
||||||
unless %w(submit replied update comment valid depose process).include?(action)
|
unless %w(submit replied update comment valid submit_validate process).include?(action)
|
||||||
fail 'action is not valid'
|
fail 'action is not valid'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ class Dossier < ActiveRecord::Base
|
||||||
if draft?
|
if draft?
|
||||||
submitted!
|
submitted!
|
||||||
end
|
end
|
||||||
when 'depose'
|
when 'submit_validate'
|
||||||
if validated?
|
if validated?
|
||||||
deposited!
|
submit_validated!
|
||||||
end
|
end
|
||||||
when 'update'
|
when 'update'
|
||||||
if replied?
|
if replied?
|
||||||
|
@ -93,7 +93,7 @@ class Dossier < ActiveRecord::Base
|
||||||
validated!
|
validated!
|
||||||
end
|
end
|
||||||
when 'process'
|
when 'process'
|
||||||
if deposited?
|
if submit_validated?
|
||||||
processed!
|
processed!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -102,7 +102,7 @@ class Dossier < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.a_traiter
|
def self.a_traiter
|
||||||
Dossier.where("state='submitted' OR state='updated' OR state='deposited'").order('updated_at ASC')
|
Dossier.where("state='submitted' OR state='updated' OR state='submit_validated'").order('updated_at ASC')
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.en_attente
|
def self.en_attente
|
||||||
|
|
|
@ -39,16 +39,16 @@
|
||||||
|
|
||||||
%div.row{style: 'text-align:right'}
|
%div.row{style: 'text-align:right'}
|
||||||
-unless gestionnaire_signed_in?
|
-unless gestionnaire_signed_in?
|
||||||
-if !@dossier.validated? && !@dossier.deposited? && !@dossier.processed?
|
-if !@dossier.validated? && !@dossier.submit_validated? && !@dossier.processed?
|
||||||
%a#maj_infos.btn.btn-info{href: "/users/dossiers/#{@dossier.id}/description?back_url=recapitulatif"}
|
%a#maj_infos.btn.btn-info{href: "/users/dossiers/#{@dossier.id}/description?back_url=recapitulatif"}
|
||||||
= 'Editer mon dossier'
|
= 'Editer mon dossier'
|
||||||
|
|
||||||
-unless user_signed_in?
|
-unless user_signed_in?
|
||||||
-if !@dossier.validated? && !@dossier.deposited? && !@dossier.processed?
|
-if !@dossier.validated? && !@dossier.submit_validated? && !@dossier.processed?
|
||||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
||||||
%button#action_button.btn.btn-success
|
%button#action_button.btn.btn-success
|
||||||
= 'Valider le dossier'
|
= 'Valider le dossier'
|
||||||
-elsif @dossier.deposited?
|
-elsif @dossier.submit_validated?
|
||||||
= form_tag(url_for({controller: 'backoffice/dossiers', action: :process_end, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
= form_tag(url_for({controller: 'backoffice/dossiers', action: :process_end, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
||||||
%button#action_button.btn.btn-success
|
%button#action_button.btn.btn-success
|
||||||
= 'Traiter le dossier'
|
= 'Traiter le dossier'
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
%button#action_button.btn.btn-success
|
%button#action_button.btn.btn-success
|
||||||
= 'Soumettre mon dossier'
|
= 'Soumettre mon dossier'
|
||||||
-elsif @dossier.validated?
|
-elsif @dossier.validated?
|
||||||
= form_tag(url_for({controller: :recapitulatif, action: :depose, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
= form_tag(url_for({controller: :recapitulatif, action: :submit_validate, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST') do
|
||||||
%button#action_button.btn.btn-success
|
%button#action_button.btn.btn-success
|
||||||
= 'Déposer mon dossier'
|
= 'Déposer mon dossier'
|
||||||
-else
|
-else
|
||||||
|
|
|
@ -27,7 +27,7 @@ Rails.application.routes.draw do
|
||||||
post 'description' => 'description#create'
|
post 'description' => 'description#create'
|
||||||
get '/recapitulatif' => 'recapitulatif#show'
|
get '/recapitulatif' => 'recapitulatif#show'
|
||||||
post '/recapitulatif/submit' => 'recapitulatif#submit'
|
post '/recapitulatif/submit' => 'recapitulatif#submit'
|
||||||
post '/recapitulatif/depose' => 'recapitulatif#depose'
|
post '/recapitulatif/submit_validate' => 'recapitulatif#submit_validate'
|
||||||
# get '/demande' => 'demandes#show'
|
# get '/demande' => 'demandes#show'
|
||||||
# post '/demande' => 'demandes#update'
|
# post '/demande' => 'demandes#update'
|
||||||
post '/commentaire' => 'commentaires#create'
|
post '/commentaire' => 'commentaires#create'
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ChangeStateDepositedToSubmitValidate < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
Dossier.where(state: 'deposited').update_all(state: 'submit_validated')
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20151102104309) do
|
ActiveRecord::Schema.define(version: 20151102105011) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
|
@ -48,7 +48,7 @@ describe Backoffice::DossiersController, type: :controller do
|
||||||
describe 'POST #process_end' do
|
describe 'POST #process_end' do
|
||||||
context 'le gestionnaire taite un dossier' do
|
context 'le gestionnaire taite un dossier' do
|
||||||
before do
|
before do
|
||||||
dossier.deposited!
|
dossier.submit_validated!
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -40,16 +40,16 @@ describe Users::RecapitulatifController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #depose' do
|
describe 'POST #submit_validate' do
|
||||||
context 'when an user depose his dossier' do
|
context 'when an user depose his dossier' do
|
||||||
before do
|
before do
|
||||||
dossier.validated!
|
dossier.validated!
|
||||||
post :depose, dossier_id: dossier.id
|
post :submit_validate, dossier_id: dossier.id
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'dossier change his state for deposed' do
|
it 'dossier change his state for submit_validated' do
|
||||||
dossier.reload
|
dossier.reload
|
||||||
expect(dossier.state).to eq('deposited')
|
expect(dossier.state).to eq('submit_validated')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'a message informe user what his dossier is submitted' do
|
it 'a message informe user what his dossier is submitted' do
|
||||||
|
|
|
@ -37,8 +37,8 @@ describe DossierDecorator do
|
||||||
expect(subject).to eq('Validé')
|
expect(subject).to eq('Validé')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'deposited is dépose' do
|
it 'submit_validated is dépose' do
|
||||||
dossier.deposited!
|
dossier.submit_validated!
|
||||||
expect(subject).to eq('Déposé')
|
expect(subject).to eq('Déposé')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -294,10 +294,10 @@ describe Dossier do
|
||||||
it { is_expected.to eq('validated') }
|
it { is_expected.to eq('validated') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when is deposed the dossier' do
|
context 'when is submit_validated the dossier' do
|
||||||
let(:action) { 'depose' }
|
let(:action) { 'submit_validate' }
|
||||||
|
|
||||||
it { is_expected.to eq('deposited') }
|
it { is_expected.to eq('submit_validated') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -312,9 +312,9 @@ describe Dossier do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier is at state deposited' do
|
context 'when dossier is at state submit_validated' do
|
||||||
before do
|
before do
|
||||||
dossier.deposited!
|
dossier.submit_validated!
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is connect' do
|
context 'when user is connect' do
|
||||||
|
@ -323,7 +323,7 @@ describe Dossier do
|
||||||
context 'when is post a comment' do
|
context 'when is post a comment' do
|
||||||
let(:action) { 'comment' }
|
let(:action) { 'comment' }
|
||||||
|
|
||||||
it { is_expected.to eq('deposited') }
|
it { is_expected.to eq('submit_validated') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ describe Dossier do
|
||||||
context 'when is post a comment' do
|
context 'when is post a comment' do
|
||||||
let(:action) { 'comment' }
|
let(:action) { 'comment' }
|
||||||
|
|
||||||
it {is_expected.to eq('deposited')}
|
it {is_expected.to eq('submit_validated')}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when is processed the dossier' do
|
context 'when is processed the dossier' do
|
||||||
|
@ -378,7 +378,7 @@ describe Dossier do
|
||||||
let!(:dossier4) { create(:dossier, :with_user, :with_procedure, state: 'replied')}
|
let!(:dossier4) { create(:dossier, :with_user, :with_procedure, state: 'replied')}
|
||||||
let!(:dossier5) { create(:dossier, :with_user, :with_procedure, state: 'updated')}
|
let!(:dossier5) { create(:dossier, :with_user, :with_procedure, state: 'updated')}
|
||||||
let!(:dossier6) { create(:dossier, :with_user, :with_procedure, state: 'validated')}
|
let!(:dossier6) { create(:dossier, :with_user, :with_procedure, state: 'validated')}
|
||||||
let!(:dossier7) { create(:dossier, :with_user, :with_procedure, state: 'deposited')}
|
let!(:dossier7) { create(:dossier, :with_user, :with_procedure, state: 'submit_validated')}
|
||||||
let!(:dossier8) { create(:dossier, :with_user, :with_procedure, state: 'processed')}
|
let!(:dossier8) { create(:dossier, :with_user, :with_procedure, state: 'processed')}
|
||||||
|
|
||||||
describe '#a_traiter' do
|
describe '#a_traiter' do
|
||||||
|
|
|
@ -103,9 +103,9 @@ describe 'backoffice/dossiers/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier have state deposited' do
|
context 'when dossier have state submit_validated' do
|
||||||
before do
|
before do
|
||||||
dossier.deposited!
|
dossier.submit_validated!
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,9 @@ describe 'users/recapitulatif/show.html.haml', type: :view do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier state is deposited' do
|
context 'when dossier state is submit_validated' do
|
||||||
before do
|
before do
|
||||||
dossier.deposited!
|
dossier.submit_validated!
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue