2024-05-21 11:57:43 +02:00
|
|
|
ProcedureDetail = Struct.new(:id, :libelle, :published_at, :aasm_state, :estimated_dossiers_count, :admin_count, :template, :latest_zone_labels, keyword_init: true) do
|
2022-12-16 15:24:05 +01:00
|
|
|
include SpreadsheetArchitect
|
|
|
|
|
|
|
|
def spreadsheet_columns
|
2024-01-30 11:16:24 +01:00
|
|
|
[:id, :libelle, :published_at, :aasm_state, :admin_count, :template].map do |attribute|
|
2022-12-16 15:24:05 +01:00
|
|
|
[I18n.t(attribute, scope: 'activerecord.attributes.procedure_export'), attribute]
|
|
|
|
end
|
|
|
|
end
|
2023-01-06 17:53:20 +01:00
|
|
|
|
2024-01-16 18:40:45 +01:00
|
|
|
AdministrateursCounter = Struct.new(:count)
|
|
|
|
|
2023-01-06 17:53:20 +01:00
|
|
|
def administrateurs
|
2024-01-16 18:40:45 +01:00
|
|
|
AdministrateursCounter.new(admin_count)
|
2023-01-06 17:53:20 +01:00
|
|
|
end
|
2024-05-21 11:57:43 +02:00
|
|
|
|
|
|
|
def parsed_latest_zone_labels
|
2024-06-05 13:52:18 +02:00
|
|
|
return [] if latest_zone_labels.nil? || latest_zone_labels.strip.empty?
|
2024-05-21 11:57:43 +02:00
|
|
|
JSON.parse(latest_zone_labels.tr('{', '[').tr('}', ']'))
|
|
|
|
rescue JSON::ParserError
|
|
|
|
[]
|
|
|
|
end
|
2022-12-16 15:24:05 +01:00
|
|
|
end
|