feat(instructeurs/procedures#show): add dossier experiant in procedure#show
This commit is contained in:
parent
2dfbc70d41
commit
d87f8b57cc
7 changed files with 53 additions and 9 deletions
|
@ -17,7 +17,11 @@ module Instructeurs
|
|||
@dossiers_a_suivre_count_per_procedure = dossiers.without_followers.en_cours.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
@dossiers_archived_count_per_procedure = dossiers.archived.group('groupe_instructeurs.procedure_id').count #why not reorder(nil)
|
||||
@dossiers_termines_count_per_procedure = dossiers.termine.group('groupe_instructeurs.procedure_id').reorder(nil).count
|
||||
@dossiers_expirant_count_per_procedure = dossiers.close_to_expiration.group('groupe_instructeurs.procedure_id').count #why not reorder(nil)
|
||||
<<<<<<< HEAD
|
||||
@dossiers_expirant_count_per_procedure = dossiers.termine_close_to_expiration.group('groupe_instructeurs.procedure_id').count #why not reorder(nil)
|
||||
=======
|
||||
@dossiers_expirant_count_per_procedure = dossiers.termine_or_en_construction_close_to_expiration.group('groupe_instructeurs.procedure_id').count # why not reorder(nil)
|
||||
>>>>>>> 2722cf295 (fixup! feat(instructeurs/procedures#show): add dossier experiant in procedure#show)
|
||||
groupe_ids = current_instructeur.groupe_instructeurs.pluck(:id)
|
||||
|
||||
@followed_dossiers_count_per_procedure = current_instructeur
|
||||
|
@ -51,7 +55,7 @@ module Instructeurs
|
|||
@current_filters = current_filters
|
||||
@displayed_fields_options, @displayed_fields_selected = procedure_presentation.displayed_fields_for_select
|
||||
|
||||
@a_suivre_count, @suivis_count, @traites_count, @tous_count, @archives_count = current_instructeur
|
||||
@a_suivre_count, @suivis_count, @traites_count, @tous_count, @archives_count, @expirant_count = current_instructeur
|
||||
.dossiers_count_summary(groupe_instructeur_ids)
|
||||
.fetch_values('a_suivre', 'suivis', 'traites', 'tous', 'archives', 'expirant')
|
||||
|
||||
|
@ -72,7 +76,7 @@ module Instructeurs
|
|||
@termines_dossiers = dossiers_visibles.termine
|
||||
@all_state_dossiers = dossiers_visibles.all_state
|
||||
@archived_dossiers = dossiers_visibles.archived
|
||||
@expirant_dossiers = dossiers_visibles.close_to_expiration
|
||||
@expirant_dossiers = dossiers_visibles.termine_or_en_construction_close_to_expiration
|
||||
|
||||
@dossiers = case statut
|
||||
when 'a-suivre'
|
||||
|
@ -91,7 +95,7 @@ module Instructeurs
|
|||
dossiers_count = @archives_count
|
||||
@archived_dossiers
|
||||
when 'expirant'
|
||||
dossiers_count = @archives_count
|
||||
dossiers_count = @expirant_count
|
||||
@expirant_dossiers
|
||||
end
|
||||
|
||||
|
|
|
@ -319,6 +319,13 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
scope :termine_or_en_construction_close_to_expiration, -> do
|
||||
joins(:procedure).scoping do
|
||||
interval_en_construction_close_to_expiration
|
||||
.or(interval_termine_close_to_expiration)
|
||||
end
|
||||
end
|
||||
|
||||
scope :brouillon_expired, -> do
|
||||
state_brouillon
|
||||
.where("brouillon_close_to_expiration_notice_sent_at + INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_EXPIRATION })
|
||||
|
|
|
@ -44,3 +44,8 @@
|
|||
instructeur_procedure_path(procedure, statut: 'archives'),
|
||||
active: statut == 'archives',
|
||||
badge: number_with_html_delimiter(archives_count))
|
||||
|
||||
= tab_item(t('pluralize.dossiers_close_to_expiration', count: expirant_count),
|
||||
instructeur_procedure_path(procedure, statut: 'expirant'),
|
||||
active: statut == 'expirant',
|
||||
badge: number_with_html_delimiter(expirant_count))
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
traites_count: @traites_count,
|
||||
tous_count: @tous_count,
|
||||
archives_count: @archives_count,
|
||||
expirant_count: @expirant_count,
|
||||
has_en_cours_notifications: @has_en_cours_notifications,
|
||||
has_termine_notifications: @has_termine_notifications }
|
||||
|
||||
|
@ -42,6 +43,8 @@
|
|||
= link_to deleted_dossiers_instructeur_procedure_path(@procedure) do
|
||||
%span.icon.delete
|
||||
Afficher les dossiers supprimés
|
||||
- if @statut == 'expirant'
|
||||
%p.explication-onglet Les dossiers n'expireront pas avant la période de conservation des données.
|
||||
|
||||
- if @filtered_sorted_paginated_ids.present? || @current_filters.count > 0
|
||||
- pagination = paginate @filtered_sorted_paginated_ids
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class AddExpirantsToProcedurePresentations < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
ProcedurePresentation.update_all(%Q(filters = filters || '{"expirant": []}'))
|
||||
change_column_default :procedure_presentations, :filters, {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[], "expirant": []}
|
||||
end
|
||||
|
||||
def down
|
||||
change_column_default :procedure_presentations, :filters, {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[]}
|
||||
end
|
||||
end
|
|
@ -576,7 +576,7 @@ ActiveRecord::Schema.define(version: 2021_11_27_143736) do
|
|||
create_table "procedure_presentations", id: :serial, force: :cascade do |t|
|
||||
t.integer "assign_to_id"
|
||||
t.jsonb "sort", default: {"order"=>"desc", "table"=>"notifications", "column"=>"notifications"}, null: false
|
||||
t.jsonb "filters", default: {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[]}, null: false
|
||||
t.jsonb "filters", default: {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[], "expirant"=>[]}, null: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.jsonb "displayed_fields", default: [{"label"=>"Demandeur", "table"=>"user", "column"=>"email"}], null: false
|
||||
|
@ -646,11 +646,7 @@ ActiveRecord::Schema.define(version: 2021_11_27_143736) do
|
|||
t.text "api_particulier_scopes", default: [], array: true
|
||||
t.jsonb "api_particulier_sources", default: {}
|
||||
t.boolean "instructeurs_self_management_enabled"
|
||||
<<<<<<< HEAD
|
||||
t.bigint "zone_id"
|
||||
t.index ["api_particulier_sources"], name: "index_procedures_on_api_particulier_sources", using: :gin
|
||||
=======
|
||||
>>>>>>> a6fcae97b (refactor(traitement.process_expired): move process expired to procedure)
|
||||
t.boolean "routing_enabled"
|
||||
t.boolean "procedure_expires_when_termine_enabled", default: false
|
||||
t.index ["api_particulier_sources"], name: "index_procedures_on_api_particulier_sources", using: :gin
|
||||
|
|
|
@ -107,6 +107,15 @@ describe Dossier do
|
|||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
context 'when .termine_or_en_construction_close_to_expiration' do
|
||||
subject { Dossier.termine_or_en_construction_close_to_expiration }
|
||||
it do
|
||||
is_expected.not_to include(young_dossier)
|
||||
is_expected.to include(expiring_dossier)
|
||||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'termine_close_to_expiration' do
|
||||
|
@ -134,6 +143,16 @@ describe Dossier do
|
|||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when .close_to_expiration' do
|
||||
subject { Dossier.termine_or_en_construction_close_to_expiration }
|
||||
it do
|
||||
is_expected.not_to include(young_dossier)
|
||||
is_expected.to include(expiring_dossier)
|
||||
is_expected.to include(just_expired_dossier)
|
||||
is_expected.to include(long_expired_dossier)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with_notifications' do
|
||||
|
|
Loading…
Reference in a new issue