diff options
| author | Zog | 2018-04-30 07:12:49 +0200 |
|---|---|---|
| committer | Zog | 2018-05-07 15:03:07 +0200 |
| commit | 657fea85b193fb9908dcaa42391bec230e93d857 (patch) | |
| tree | a14caaca05bdd7a500a765ca768c15986b7fd740 /config | |
| parent | 42ac1fa61ea79fe612bcd98f2b38bad5b6f24421 (diff) | |
| download | chouette-core-657fea85b193fb9908dcaa42391bec230e93d857.tar.bz2 | |
Fix NETEX imports
Diffstat (limited to 'config')
| -rw-r--r-- | config/initializers/stif.rb | 37 | ||||
| -rw-r--r-- | config/locales/import_messages.fr.yml | 2 |
2 files changed, 21 insertions, 18 deletions
diff --git a/config/initializers/stif.rb b/config/initializers/stif.rb index 2ddadbc7e..ab2410b33 100644 --- a/config/initializers/stif.rb +++ b/config/initializers/stif.rb @@ -1,27 +1,30 @@ # coding: utf-8 -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") - line_referential.organisations << organisation - stop_area_referential.organisations << organisation +unless ENV.fetch("SEED", false) || Rails.env.test? + 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") - workgroup = Workgroup.find_or_create_by(name: "Gestion de l'offre théorique IDFm") do |w| - w.line_referential = line_referential - w.stop_area_referential = stop_area_referential - end + line_referential.organisations << organisation + stop_area_referential.organisations << organisation - workbench = 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 - w.workgroup = workgroup + workgroup = Workgroup.find_or_create_by(name: "Gestion de l'offre théorique IDFm") do |w| + w.line_referential = line_referential + w.stop_area_referential = stop_area_referential + end - Rails.logger.debug "Create Workbench for #{organisation.name}" + workbench = 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 + w.workgroup = workgroup + + Rails.logger.debug "Create Workbench for #{organisation.name}" + end end end -end unless Rails.env.test? +end Rails.application.config.to_prepare do Organisation.before_validation(on: :create) do |organisation| diff --git a/config/locales/import_messages.fr.yml b/config/locales/import_messages.fr.yml index c05b8dc85..e76ad7381 100644 --- a/config/locales/import_messages.fr.yml +++ b/config/locales/import_messages.fr.yml @@ -18,7 +18,7 @@ fr: trips: imported: "%{count} course(s) importé(s)" calendars: - imported: "%{count} calndrier(s) importé(s)" + imported: "%{count} calendrier(s) importé(s)" 1_netexstif_2: "Le fichier %{source_filename} ne respecte pas la syntaxe XML ou la XSD NeTEx : erreur '%{error_value}' rencontré" 1_netexstif_5: "%{source_filename}-Ligne %{source_line_number}-Colonne %{source_column_number} : l'objet %{source_label} d'identifiant %{source_objectid} a une date de mise à jour dans le futur" 2_netexstif_1_1: "Le fichier commun.xml ne contient pas de frame nommée NTEX_COMMUN" |
