Instructeur : add overview table with counts for files
nombre total de dossier : - 'à suivre' - 'suivi' - 'traité' - 'dossier' - 'archivé'
This commit is contained in:
parent
22515ffbfe
commit
a486fe9a2e
7 changed files with 87 additions and 4 deletions
|
@ -3,6 +3,10 @@
|
||||||
@import "mixins";
|
@import "mixins";
|
||||||
|
|
||||||
.procedure-list {
|
.procedure-list {
|
||||||
|
&.synthese {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.procedure-item {
|
.procedure-item {
|
||||||
border-bottom: 1px solid $border-grey;
|
border-bottom: 1px solid $border-grey;
|
||||||
|
|
||||||
|
@ -51,7 +55,7 @@
|
||||||
width: 90px;
|
width: 90px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&:hover {
|
&:not(.procedure-synthese):hover {
|
||||||
background-color: rgba(0, 0, 0, 0.05);
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,18 @@ module Instructeurs
|
||||||
.group('groupe_instructeurs.procedure_id')
|
.group('groupe_instructeurs.procedure_id')
|
||||||
.reorder(nil)
|
.reorder(nil)
|
||||||
.count
|
.count
|
||||||
|
|
||||||
|
@all_dossiers_counts = {}
|
||||||
|
@all_dossiers_counts['à suivre'] = dossiers.without_followers.en_cours.count
|
||||||
|
@all_dossiers_counts['suivi'] = current_instructeur
|
||||||
|
.followed_dossiers
|
||||||
|
.joins(:groupe_instructeur)
|
||||||
|
.en_cours
|
||||||
|
.where(groupe_instructeur_id: groupe_ids)
|
||||||
|
.count
|
||||||
|
@all_dossiers_counts['traité'] = dossiers.termine.count
|
||||||
|
@all_dossiers_counts['dossier'] = dossiers.all_state.count
|
||||||
|
@all_dossiers_counts['archivé'] = dossiers.archived.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
11
app/views/instructeurs/procedures/_synthese.html.haml
Normal file
11
app/views/instructeurs/procedures/_synthese.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
.tab-title
|
||||||
|
Synthèse des dossiers
|
||||||
|
.procedure-list.synthese
|
||||||
|
%ul.procedure-stats.flex
|
||||||
|
- all_dossiers_counts.each_with_index do |(label, dossier_count)|
|
||||||
|
%li.procedure-synthese
|
||||||
|
%object
|
||||||
|
.stats-number
|
||||||
|
= number_with_html_delimiter(dossier_count)
|
||||||
|
.stats-legend
|
||||||
|
= label
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
.container
|
.container
|
||||||
%h1.page-title Démarches
|
%h1.page-title Démarches
|
||||||
|
= render partial: 'instructeurs/procedures/synthese', locals: { all_dossiers_counts: @all_dossiers_counts }
|
||||||
|
|
||||||
= render partial: 'instructeurs/procedures/list', locals: { procedures: @procedures,
|
= render partial: 'instructeurs/procedures/list', locals: { procedures: @procedures,
|
||||||
dossiers_count_per_procedure: @dossiers_count_per_procedure,
|
dossiers_count_per_procedure: @dossiers_count_per_procedure,
|
||||||
|
|
|
@ -134,6 +134,12 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(nil) }
|
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(nil) }
|
||||||
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure.id]).to eq(nil) }
|
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure.id]).to eq(nil) }
|
||||||
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(nil) }
|
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(nil) }
|
||||||
|
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(0) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(0) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(0) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(0) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(0) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with not draft state on multiple procedures" do
|
context "with not draft state on multiple procedures" do
|
||||||
|
@ -164,6 +170,12 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure2.id]).to eq(1) }
|
it { expect(assigns(:followed_dossiers_count_per_procedure)[procedure2.id]).to eq(1) }
|
||||||
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure2.id]).to eq(nil) }
|
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure2.id]).to eq(nil) }
|
||||||
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure2.id]).to eq(1) }
|
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure2.id]).to eq(1) }
|
||||||
|
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(3 + 0) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(0 + 1) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(0 + 1) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(3 + 3) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(1 + 0) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -198,6 +210,12 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(10) }
|
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(10) }
|
||||||
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(4 + 6 + 10) }
|
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(4 + 6 + 10) }
|
||||||
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(14) }
|
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(14) }
|
||||||
|
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(4) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(6) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(10) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(4 + 6 + 10) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(14) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when an instructeur only belongs to one of them gi' do
|
context 'when an instructeur only belongs to one of them gi' do
|
||||||
|
@ -213,6 +231,12 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(5) }
|
it { expect(assigns(:dossiers_termines_count_per_procedure)[procedure.id]).to eq(5) }
|
||||||
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(2 + 3 + 5) }
|
it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(2 + 3 + 5) }
|
||||||
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(7) }
|
it { expect(assigns(:dossiers_archived_count_per_procedure)[procedure.id]).to eq(7) }
|
||||||
|
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(2) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['suivi']).to eq(3) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['traité']).to eq(5) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['dossier']).to eq(2 + 3 + 5) }
|
||||||
|
it { expect(assigns(:all_dossiers_counts)['archivé']).to eq(7) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -122,7 +122,9 @@ feature 'The routing', js: true do
|
||||||
|
|
||||||
## on the procedures list
|
## on the procedures list
|
||||||
expect(page).to have_current_path(instructeur_procedures_path)
|
expect(page).to have_current_path(instructeur_procedures_path)
|
||||||
expect(find('.procedure-stats')).to have_css('span.notifications')
|
within find('.procedure-details') do
|
||||||
|
expect(find('.procedure-stats')).to have_css('span.notifications')
|
||||||
|
end
|
||||||
|
|
||||||
## on the dossiers list
|
## on the dossiers list
|
||||||
click_on procedure.libelle
|
click_on procedure.libelle
|
||||||
|
@ -142,7 +144,9 @@ feature 'The routing', js: true do
|
||||||
sign_in_with marie.user.email, password
|
sign_in_with marie.user.email, password
|
||||||
|
|
||||||
expect(page).to have_current_path(instructeur_procedures_path)
|
expect(page).to have_current_path(instructeur_procedures_path)
|
||||||
expect(find('.procedure-stats')).not_to have_css('span.notifications')
|
within find('.procedure-details') do
|
||||||
|
expect(find('.procedure-stats')).not_to have_css('span.notifications')
|
||||||
|
end
|
||||||
log_out
|
log_out
|
||||||
|
|
||||||
# the instructeurs who belong to scientifique AND litteraire groups manage scientifique and litterraire dossiers
|
# the instructeurs who belong to scientifique AND litteraire groups manage scientifique and litterraire dossiers
|
||||||
|
@ -168,7 +172,9 @@ feature 'The routing', js: true do
|
||||||
sign_in_with superwoman.user.email, password
|
sign_in_with superwoman.user.email, password
|
||||||
|
|
||||||
expect(page).to have_current_path(instructeur_procedures_path)
|
expect(page).to have_current_path(instructeur_procedures_path)
|
||||||
expect(find('.procedure-stats')).to have_css('span.notifications')
|
within find('.procedure-details') do
|
||||||
|
expect(find('.procedure-stats')).to have_css('span.notifications')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish_procedure(procedure)
|
def publish_procedure(procedure)
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
describe 'instructeurs/procedures/_synthese.html.haml', type: :view do
|
||||||
|
let(:current_instructeur) { create(:instructeur) }
|
||||||
|
let(:procedure) { create(:procedure) }
|
||||||
|
let!(:dossier) { create(:dossier, procedure: procedure) }
|
||||||
|
|
||||||
|
subject {
|
||||||
|
render 'instructeurs/procedures/synthese.html.haml',
|
||||||
|
all_dossiers_counts: {
|
||||||
|
'à suivre': 0,
|
||||||
|
'suivi': 0,
|
||||||
|
'traité': 1,
|
||||||
|
'dossier': 1,
|
||||||
|
'archivé': 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context 'when instructeur has 1 procedure and has 1 dossier' do
|
||||||
|
it { is_expected.to have_text('Synthèse des dossiers') }
|
||||||
|
it { is_expected.to have_css('.synthese') }
|
||||||
|
it { is_expected.to have_text('suivi') }
|
||||||
|
it { is_expected.to have_text('traité') }
|
||||||
|
it { is_expected.to have_text('dossier') }
|
||||||
|
it { is_expected.to have_text('archivé') }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue