feat(manager/outdated_procedure): enhance procedure cleanup

This commit is contained in:
Martin 2022-10-05 16:31:41 +02:00 committed by mfo
parent 84b1888d3a
commit 6000de2095
3 changed files with 26 additions and 6 deletions

View file

@ -69,7 +69,7 @@ to display a collection of resources in an HTML table.
<%= %(tabindex=0 role=link data-url=#{polymorphic_path([namespace, resource])}) %>
<% end %>
>
<td><%= f.check_box "procedure[ids][#{resource.id}]", checked: true %></td>
<td><%= f.check_box "procedure[ids][#{resource.id}]", checked: false %></td>
<% collection_presenter.attributes_for(resource).each do |attribute| %>
<td class="js-table-row cell-data cell-data--<%= attribute.html_class %>">
<% if show_action? :show, resource -%>

View file

@ -1,9 +1,8 @@
fr:
activemodel:
models:
dubious_procedure:
other: Démarches douteuses
outdated_procedure:
other: Démarches sans expiration
attributes:
dubious_procedure:
dubious_champs: Champs douteux
aasm_state: Etat
outdated_procedure:
dossiers_close_to_expiration: Dossier pouvant être expirés

View file

@ -0,0 +1,21 @@
namespace :after_party do
desc 'Deployment task: enable_procedure_expires_when_termine_enabled_on_procedure_without_dossiers'
task enable_procedure_expires_when_termine_enabled_on_procedure_without_dossiers: :environment do
puts "Running deploy task 'enable_procedure_expires_when_termine_enabled_on_procedure_without_dossiers'"
# Put your task implementation HERE.
procedure_without_expiration = Procedure.where(procedure_expires_when_termine_enabled: false)
progress = ProgressReport.new(procedure_without_expiration.count)
procedure_without_expiration.find_each do |procedure|
if procedure.dossiers.count.zero?
procedure.update(procedure_expires_when_termine_enabled: true)
end
progress.inc
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