Revert "Merge pull request #6142 from tchak/enable_brouillon_extend_conservation"
This reverts commit48eb4d9778
, reversing changes made to5539d5cb8c
. # Conflicts: # app/models/dossier.rb # db/schema.rb
This commit is contained in:
parent
4cba6e3b11
commit
bcbfcdc537
8 changed files with 15 additions and 64 deletions
|
@ -161,7 +161,7 @@ module Users
|
||||||
end
|
end
|
||||||
|
|
||||||
def extend_conservation
|
def extend_conservation
|
||||||
dossier.update(conservation_extension: dossier.conservation_extension + 1.month)
|
dossier.update(en_construction_conservation_extension: dossier.en_construction_conservation_extension + 1.month)
|
||||||
flash[:notice] = 'Votre dossier sera conservé un mois supplémentaire'
|
flash[:notice] = 'Votre dossier sera conservé un mois supplémentaire'
|
||||||
redirect_to dossier_path(@dossier)
|
redirect_to dossier_path(@dossier)
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
# archived :boolean default(FALSE)
|
# archived :boolean default(FALSE)
|
||||||
# autorisation_donnees :boolean
|
# autorisation_donnees :boolean
|
||||||
# brouillon_close_to_expiration_notice_sent_at :datetime
|
# brouillon_close_to_expiration_notice_sent_at :datetime
|
||||||
# conservation_extension :interval default(0 seconds)
|
|
||||||
# deleted_user_email_never_send :string
|
# deleted_user_email_never_send :string
|
||||||
# en_construction_at :datetime
|
# en_construction_at :datetime
|
||||||
# en_construction_close_to_expiration_notice_sent_at :datetime
|
# en_construction_close_to_expiration_notice_sent_at :datetime
|
||||||
|
@ -256,22 +255,21 @@ class Dossier < ApplicationRecord
|
||||||
scope :brouillon_close_to_expiration, -> do
|
scope :brouillon_close_to_expiration, -> do
|
||||||
state_brouillon
|
state_brouillon
|
||||||
.joins(:procedure)
|
.joins(:procedure)
|
||||||
.where("dossiers.created_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
.where("dossiers.created_at + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||||
end
|
end
|
||||||
scope :en_construction_close_to_expiration, -> do
|
scope :en_construction_close_to_expiration, -> do
|
||||||
state_en_construction
|
state_en_construction
|
||||||
.joins(:procedure)
|
.joins(:procedure)
|
||||||
.where("dossiers.en_construction_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
.where("dossiers.en_construction_at + dossiers.en_construction_conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||||
end
|
end
|
||||||
scope :en_instruction_close_to_expiration, -> do
|
scope :en_instruction_close_to_expiration, -> do
|
||||||
state_en_instruction
|
state_en_instruction
|
||||||
.joins(:procedure)
|
.joins(:procedure)
|
||||||
.where("dossiers.en_instruction_at + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
.where("dossiers.en_instruction_at + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||||
end
|
end
|
||||||
scope :termine_close_to_expiration, -> do
|
def self.termine_close_to_expiration
|
||||||
state_termine
|
dossier_ids = Traitement.termine_close_to_expiration.pluck(:dossier_id).uniq
|
||||||
.joins(:procedure)
|
Dossier.where(id: dossier_ids)
|
||||||
.where(id: Traitement.termine_close_to_expiration.pluck(:dossier_id).uniq)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scope :brouillon_expired, -> do
|
scope :brouillon_expired, -> do
|
||||||
|
@ -455,15 +453,7 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def en_construction_close_to_expiration?
|
def en_construction_close_to_expiration?
|
||||||
self.class.en_construction_close_to_expiration.exists?(id: self)
|
Dossier.en_construction_close_to_expiration.where(id: self).present?
|
||||||
end
|
|
||||||
|
|
||||||
def brouillon_close_to_expiration?
|
|
||||||
self.class.brouillon_close_to_expiration.exists?(id: self)
|
|
||||||
end
|
|
||||||
|
|
||||||
def close_to_expiration?
|
|
||||||
en_construction_close_to_expiration? || brouillon_close_to_expiration?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_groupe_instructeur_details?
|
def show_groupe_instructeur_details?
|
||||||
|
@ -646,7 +636,6 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_passer_en_construction
|
def after_passer_en_construction
|
||||||
update!(conservation_extension: 0.days)
|
|
||||||
update!(en_construction_at: Time.zone.now) if self.en_construction_at.nil?
|
update!(en_construction_at: Time.zone.now) if self.en_construction_at.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -663,7 +652,6 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_repasser_en_construction(instructeur)
|
def after_repasser_en_construction(instructeur)
|
||||||
update!(conservation_extension: 0.days)
|
|
||||||
log_dossier_operation(instructeur, :repasser_en_construction)
|
log_dossier_operation(instructeur, :repasser_en_construction)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,11 @@
|
||||||
%li
|
%li
|
||||||
= link_to "Tout le dossier", dossier_path(dossier, format: :pdf), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
= link_to "Tout le dossier", dossier_path(dossier, format: :pdf), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
||||||
|
|
||||||
- if dossier.close_to_expiration?
|
- if dossier.en_construction_close_to_expiration?
|
||||||
.card.warning
|
.card.warning
|
||||||
.card-title Votre dossier va expirer
|
.card-title Votre dossier va expirer
|
||||||
- if dossier.brouillon?
|
|
||||||
%p
|
%p
|
||||||
Votre dossier est en brouillon, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été déposé.
|
Votre dossier a été déposé, mais va bientôt expirer. Cela signifie qu'il va bientôt être supprimé sans avoir été traité par l’administration.
|
||||||
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
|
||||||
un mois de plus en cliquant sur le bouton ci-dessous.
|
|
||||||
- else
|
|
||||||
%p
|
|
||||||
Votre dossier a été déposé, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été traité par l’administration.
|
|
||||||
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
||||||
un mois de plus en cliquant sur le bouton ci-dessous.
|
un mois de plus en cliquant sur le bouton ci-dessous.
|
||||||
%br
|
%br
|
||||||
|
|
|
@ -8,5 +8,5 @@ fr:
|
||||||
one: "Afin de limiter la conservation de vos données personnelles, le dossier en brouillon suivant sera bientôt automatiquement supprimé :"
|
one: "Afin de limiter la conservation de vos données personnelles, le dossier en brouillon suivant sera bientôt automatiquement supprimé :"
|
||||||
other: "Afin de limiter la conservation de vos données personnelles, les dossiers en brouillon suivant seront bientôt automatiquement supprimés :"
|
other: "Afin de limiter la conservation de vos données personnelles, les dossiers en brouillon suivant seront bientôt automatiquement supprimés :"
|
||||||
footer:
|
footer:
|
||||||
one: "Si vous souhaitez toujours déposer ce dossier, vous pouvez retrouver votre brouillon pendant encore <b>un mois</b>. Si vous souhaitez conserver votre dossier plus longtemps, vous pouvez <b>prolonger sa durée de conservation</b> dans l'interface. Et sinon, vous n’avez rien à faire."
|
one: "Si vous souhaitez toujours déposer ce dossier, vous pouvez retrouver votre brouillon pendant encore <b>un mois</b>. Et sinon, vous n’avez rien à faire."
|
||||||
other: "Si vous souhaitez toujours déposer ces dossiers, vous pouvez retrouver vos brouillons pendant encore <b>un mois</b>. Si vous souhaitez conserver vos dossiers plus longtemps, vous pouvez <b>prolonger leur durée de conservation</b> au cas par cas dans l'interface. Et sinon, vous n’avez rien à faire."
|
other: "Si vous souhaitez toujours déposer ces dossiers, vous pouvez retrouver vos brouillons pendant encore <b>un mois</b>. Et sinon, vous n’avez rien à faire."
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
class AddConservationExtensionToDossiers < ActiveRecord::Migration[6.1]
|
|
||||||
def change
|
|
||||||
add_column :dossiers, :conservation_extension, :interval, default: 0.days
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -274,7 +274,6 @@ ActiveRecord::Schema.define(version: 2021_04_28_114228) do
|
||||||
t.datetime "last_avis_updated_at"
|
t.datetime "last_avis_updated_at"
|
||||||
t.datetime "last_commentaire_updated_at"
|
t.datetime "last_commentaire_updated_at"
|
||||||
t.string "api_entreprise_job_exceptions", array: true
|
t.string "api_entreprise_job_exceptions", array: true
|
||||||
t.interval "conservation_extension", default: "PT0S"
|
|
||||||
t.string "deleted_user_email_never_send"
|
t.string "deleted_user_email_never_send"
|
||||||
t.index "to_tsvector('french'::regconfig, (search_terms || private_search_terms))", name: "index_dossiers_on_search_terms_private_search_terms", using: :gin
|
t.index "to_tsvector('french'::regconfig, (search_terms || private_search_terms))", name: "index_dossiers_on_search_terms_private_search_terms", using: :gin
|
||||||
t.index "to_tsvector('french'::regconfig, search_terms)", name: "index_dossiers_on_search_terms", using: :gin
|
t.index "to_tsvector('french'::regconfig, search_terms)", name: "index_dossiers_on_search_terms", using: :gin
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
namespace :after_party do
|
|
||||||
desc 'Deployment task: rename_conservation_extension'
|
|
||||||
task rename_conservation_extension: :environment do
|
|
||||||
puts "Running deploy task 'rename_conservation_extension'"
|
|
||||||
|
|
||||||
dossiers = Dossier.state_en_construction.where.not(en_construction_conservation_extension: 0.days)
|
|
||||||
dossiers.find_each do |dossier|
|
|
||||||
dossier.update_column(:conservation_extension, dossier.en_construction_conservation_extension)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Update task as completed. If you remove the line below, the task will
|
|
||||||
# run with every deploy (or every time you call after_party:run).
|
|
||||||
AfterParty::TaskRecord
|
|
||||||
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -52,15 +52,6 @@ describe Dossier do
|
||||||
is_expected.to include(just_expired_dossier)
|
is_expected.to include(just_expired_dossier)
|
||||||
is_expected.to include(long_expired_dossier)
|
is_expected.to include(long_expired_dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'does not include an expiring dossier that has been postponed' do
|
|
||||||
before do
|
|
||||||
expiring_dossier.update(conservation_extension: 1.month)
|
|
||||||
expiring_dossier.reload
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.not_to include(expiring_dossier) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'en_construction_close_to_expiration' do
|
describe 'en_construction_close_to_expiration' do
|
||||||
|
@ -81,7 +72,7 @@ describe Dossier do
|
||||||
|
|
||||||
context 'does not include an expiring dossier that has been postponed' do
|
context 'does not include an expiring dossier that has been postponed' do
|
||||||
before do
|
before do
|
||||||
expiring_dossier.update(conservation_extension: 1.month)
|
expiring_dossier.update(en_construction_conservation_extension: 1.month)
|
||||||
expiring_dossier.reload
|
expiring_dossier.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue