aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/initializers/stif.rb8
-rw-r--r--db/seeds/stif.seeds.rb7
2 files changed, 10 insertions, 5 deletions
diff --git a/config/initializers/stif.rb b/config/initializers/stif.rb
index ab2410b33..7a61e7044 100644
--- a/config/initializers/stif.rb
+++ b/config/initializers/stif.rb
@@ -1,8 +1,8 @@
# coding: utf-8
-unless ENV.fetch("SEED", false) || Rails.env.test?
- Rails.application.config.to_prepare do
- Organisation.after_create do |organisation|
+Rails.application.config.to_prepare do
+ Organisation.after_create do |organisation|
+ unless organisation.code == "STIF" # seed is in action
line_referential = LineReferential.find_by(name: "CodifLigne")
stop_area_referential = StopAreaReferential.find_by(name: "Reflex")
@@ -14,7 +14,7 @@ unless ENV.fetch("SEED", false) || Rails.env.test?
w.stop_area_referential = stop_area_referential
end
- workbench = organisation.workbenches.find_or_create_by(name: "Gestion de l'offre") do |w|
+ organisation.workbenches.find_or_create_by(name: "Gestion de l'offre") do |w|
w.line_referential = line_referential
w.stop_area_referential = stop_area_referential
w.objectid_format = Workbench.objectid_format.stif_netex
diff --git a/db/seeds/stif.seeds.rb b/db/seeds/stif.seeds.rb
index e2c5542f5..ec43db6bb 100644
--- a/db/seeds/stif.seeds.rb
+++ b/db/seeds/stif.seeds.rb
@@ -23,4 +23,9 @@ workgroup = Workgroup.seed_by(name: "Gestion de l'offre théorique IDFm") do |w|
w.owner = stif
end
-Workbench.update_all workgroup_id: workgroup
+stif.workbenches.seed_by(name: "Gestion de l'offre") do |w|
+ w.line_referential = line_referential
+ w.stop_area_referential = stop_area_referential
+ w.objectid_format = Workbench.objectid_format.stif_netex
+ w.workgroup = workgroup
+end