aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/initializers/stif.rb15
-rw-r--r--db/seeds.rb11
2 files changed, 16 insertions, 10 deletions
diff --git a/config/initializers/stif.rb b/config/initializers/stif.rb
new file mode 100644
index 000000000..1a896ba21
--- /dev/null
+++ b/config/initializers/stif.rb
@@ -0,0 +1,15 @@
+Rails.application.config.to_prepare do
+ Organisation.after_create do |organisation|
+ line_referential = LineReferential.find_by(name: "CodifLigne")
+ stop_area_referential = StopAreaReferential.find_by(name: "Reflex")
+
+ stif = Organisation.find_by(name: "STIF")
+
+ organisation.workbenches.find_or_create_by(name: "Gestion de l'offre", organisation: stif) do |workbench|
+ workbench.line_referential = line_referential
+ workbench.stop_area_referential = stop_area_referential
+
+ Rails.logger.debug "Create Workbench for #{organisation.name}"
+ end
+ end
+end unless Rails.env.test?
diff --git a/db/seeds.rb b/db/seeds.rb
index 0d7748f9c..24d70f0f1 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -42,12 +42,6 @@ line_referential = LineReferential.find_or_create_by(name: "CodifLigne") do |ref
referential.add_member operator
end
-Workbench.find_or_create_by(name: "Gestion de l'offre", organisation: stif) do |workbench|
- workbench.line_referential = line_referential
- workbench.stop_area_referential = stop_area_referential
-end
-
-
LineReferentialSync.find_or_create_by(line_referential: line_referential)
StopAreaReferentialSync.find_or_create_by(stop_area_referential: stop_area_referential)
@@ -57,10 +51,7 @@ StopAreaReferentialSync.find_or_create_by(stop_area_referential: stop_area_refer
end
end
-workbench = Workbench.find_or_create_by(name: "Gestion de l'offre", organisation: operator) do |workbench|
- workbench.line_referential = line_referential
- workbench.stop_area_referential = stop_area_referential
-end
+workbench = Workbench.find_by(name: "Gestion de l'offre")
[["parissudest201604", "Paris Sud-Est Avril 2016"],
["parissudest201605", "Paris Sud-Est Mai 2016"]].each do |slug, name|