2019-12-03 18:36:50 +01:00
|
|
|
FactoryBot.define do
|
|
|
|
factory :export do
|
2022-04-05 15:53:15 +02:00
|
|
|
format { Export.formats.fetch(:csv) }
|
|
|
|
statut { Export.statuts.fetch(:tous) }
|
2021-06-16 11:46:25 +02:00
|
|
|
time_span_type { Export.time_span_types.fetch(:everything) }
|
2020-07-20 17:22:44 +02:00
|
|
|
groupe_instructeurs { [association(:groupe_instructeur)] }
|
2021-03-31 18:19:28 +02:00
|
|
|
|
|
|
|
after(:build) do |export, _evaluator|
|
2022-10-21 16:55:42 +02:00
|
|
|
export.key = Export.generate_cache_key(export.groupe_instructeurs.map(&:id), export.procedure_presentation)
|
2024-03-14 13:11:53 +01:00
|
|
|
export.user_profile = export.groupe_instructeurs.first&.instructeurs&.first if export.user_profile.nil?
|
2023-10-09 09:15:54 +02:00
|
|
|
export.dossiers_count = 10 if !export.pending?
|
2021-03-31 18:19:28 +02:00
|
|
|
end
|
2019-12-03 18:36:50 +01:00
|
|
|
end
|
|
|
|
end
|