remove useless snapshot

This commit is contained in:
simon lehericey 2024-10-14 22:11:25 +02:00
parent b5ed8c9b61
commit 71bcbbc440
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
4 changed files with 34 additions and 28 deletions

View file

@ -17,7 +17,6 @@ class ExportDashboard < Administrate::BaseDashboard
job_status: Field::Select.with_options(searchable: false, collection: -> (field) { field.resource.class.send(field.attribute.to_s.pluralize).keys }),
key: Field::Text,
procedure_presentation: IdField,
procedure_presentation_snapshot: Field::String.with_options(searchable: false),
statut: Field::Select.with_options(searchable: false, collection: -> (field) { field.resource.class.send(field.attribute.to_s.pluralize).keys }),
time_span_type: Field::Select.with_options(searchable: false, collection: -> (field) { field.resource.class.send(field.attribute.to_s.pluralize).keys }),
created_at: Field::DateTime.with_options(format: "%d/%m %H:%M:%S"),
@ -34,7 +33,7 @@ class ExportDashboard < Administrate::BaseDashboard
# SHOW_PAGE_ATTRIBUTES
# an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = [:id, :procedure, :job_status, :format, :statut, :file, :groupe_instructeurs, :key, :procedure_presentation, :procedure_presentation_snapshot, :time_span_type, :created_at, :updated_at].freeze
SHOW_PAGE_ATTRIBUTES = [:id, :procedure, :job_status, :format, :statut, :file, :groupe_instructeurs, :key, :procedure_presentation, :time_span_type, :created_at, :updated_at].freeze
# FORM_ATTRIBUTES
# an array of attributes that will be displayed

View file

@ -3,6 +3,8 @@
class Export < ApplicationRecord
include TransientModelsWithPurgeableJobConcern
self.ignored_columns += ["procedure_presentation_snapshot"]
MAX_DUREE_CONSERVATION_EXPORT = 32.hours
MAX_DUREE_GENERATION = 16.hours
@ -59,7 +61,6 @@ class Export < ApplicationRecord
def compute
self.dossiers_count = dossiers_for_export.count
load_snapshot!
file.attach(blob.signed_id) # attaching a blob directly might run identify/virus scanner and wipe it
end
@ -94,7 +95,6 @@ class Export < ApplicationRecord
create!(**attributes, groupe_instructeurs:,
user_profile:,
procedure_presentation:,
procedure_presentation_snapshot: procedure_presentation&.snapshot,
filtered_columns:,
sorted_column:)
end
@ -129,12 +129,6 @@ class Export < ApplicationRecord
private
def load_snapshot!
if procedure_presentation_snapshot.present?
procedure_presentation.attributes = procedure_presentation_snapshot
end
end
def dossiers_for_export
@dossiers_for_export ||= begin
dossiers = Dossier.where(groupe_instructeur: groupe_instructeurs)

View file

@ -73,10 +73,6 @@ class ProcedurePresentation < ApplicationRecord
nil
end
def snapshot
slice(:filters, :sort, :displayed_fields)
end
private
def find_type_de_champ(column)