commit
3d40039182
6 changed files with 51 additions and 17 deletions
|
@ -161,7 +161,8 @@ module Users
|
||||||
end
|
end
|
||||||
|
|
||||||
def extend_conservation
|
def extend_conservation
|
||||||
dossier.update(en_construction_conservation_extension: dossier.en_construction_conservation_extension + 1.month)
|
dossier.update(en_construction_conservation_extension: dossier.en_construction_conservation_extension + 1.month,
|
||||||
|
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,6 +7,7 @@
|
||||||
# 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
|
||||||
|
@ -636,6 +637,7 @@ 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
|
||||||
|
|
||||||
|
@ -652,6 +654,7 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddConservationExtensionToDossiers < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :dossiers, :conservation_extension, :interval
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,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: 2021_05_04_115445) do
|
ActiveRecord::Schema.define(version: 2021_05_05_115445) 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"
|
||||||
|
@ -274,6 +274,7 @@ ActiveRecord::Schema.define(version: 2021_05_04_115445) 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"
|
||||||
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
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: rename_conservation_extension'
|
||||||
|
task rename_conservation_extension: :environment do
|
||||||
|
puts "Running deploy task 'rename_conservation_extension'"
|
||||||
|
|
||||||
|
BATCH_SIZE = 20_000
|
||||||
|
|
||||||
|
dossiers = Dossier.state_en_construction.where.not(en_construction_conservation_extension: 0.days)
|
||||||
|
progress = ProgressReport.new((dossiers.count.to_f / BATCH_SIZE).round)
|
||||||
|
dossiers.in_batches(of: BATCH_SIZE) do |relation|
|
||||||
|
relation.update_all("conservation_extension = en_construction_conservation_extension")
|
||||||
|
progress.inc
|
||||||
|
end
|
||||||
|
progress.finish
|
||||||
|
|
||||||
|
dossiers_without_conservation_extension = Dossier.where(conservation_extension: nil)
|
||||||
|
progress = ProgressReport.new((dossiers_without_conservation_extension.count.to_f / BATCH_SIZE).round)
|
||||||
|
dossiers_without_conservation_extension.in_batches(of: BATCH_SIZE) do |relation|
|
||||||
|
relation.update_all(conservation_extension: 'PT0S')
|
||||||
|
progress.inc
|
||||||
|
end
|
||||||
|
progress.finish
|
||||||
|
|
||||||
|
# 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
|
25
yarn.lock
25
yarn.lock
|
@ -6367,9 +6367,9 @@ hoopy@^0.1.4:
|
||||||
integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ==
|
integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ==
|
||||||
|
|
||||||
hosted-git-info@^2.1.4:
|
hosted-git-info@^2.1.4:
|
||||||
version "2.8.8"
|
version "2.8.9"
|
||||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488"
|
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
|
||||||
integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==
|
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
|
||||||
|
|
||||||
hpack.js@^2.1.6:
|
hpack.js@^2.1.6:
|
||||||
version "2.1.6"
|
version "2.1.6"
|
||||||
|
@ -7751,15 +7751,10 @@ lodash.uniq@^4.5.0:
|
||||||
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
|
||||||
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
|
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
|
||||||
|
|
||||||
lodash@^4.0.0, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.5, lodash@~4.17.12:
|
lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.5, lodash@~4.17.12:
|
||||||
version "4.17.19"
|
version "4.17.21"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||||
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
|
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||||
|
|
||||||
lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14:
|
|
||||||
version "4.17.20"
|
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
|
|
||||||
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
|
||||||
|
|
||||||
log-process-errors@^5.1.2:
|
log-process-errors@^5.1.2:
|
||||||
version "5.1.2"
|
version "5.1.2"
|
||||||
|
@ -12523,9 +12518,9 @@ url-parse-lax@^3.0.0:
|
||||||
prepend-http "^2.0.0"
|
prepend-http "^2.0.0"
|
||||||
|
|
||||||
url-parse@^1.4.3:
|
url-parse@^1.4.3:
|
||||||
version "1.4.7"
|
version "1.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278"
|
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.1.tgz#d5fa9890af8a5e1f274a2c98376510f6425f6e3b"
|
||||||
integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==
|
integrity sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
querystringify "^2.1.1"
|
querystringify "^2.1.1"
|
||||||
requires-port "^1.0.0"
|
requires-port "^1.0.0"
|
||||||
|
|
Loading…
Reference in a new issue