aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile.lock2
-rw-r--r--db/migrate/20170309102656_add_stif_type_to_stop_area.rb5
-rw-r--r--db/schema.rb7
-rw-r--r--lib/stif/reflex_synchronization.rb5
-rw-r--r--spec/tasks/reflex_rake_spec.rb5
5 files changed, 18 insertions, 6 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index 1c9f275e5..c4116d330 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -23,7 +23,7 @@ GIT
GIT
remote: git@github.com:AF83/stif-reflex-api.git
- revision: e3841486efc2218aa2fcbc4d53f85c06e41094a8
+ revision: 7c517b98c3900c9bb0b81dd0ccab97f8e8f5f249
specs:
reflex (0.0.1)
nokogiri (~> 1.6)
diff --git a/db/migrate/20170309102656_add_stif_type_to_stop_area.rb b/db/migrate/20170309102656_add_stif_type_to_stop_area.rb
new file mode 100644
index 000000000..a7b8cebfe
--- /dev/null
+++ b/db/migrate/20170309102656_add_stif_type_to_stop_area.rb
@@ -0,0 +1,5 @@
+class AddStifTypeToStopArea < ActiveRecord::Migration
+ def change
+ add_column :stop_areas, :stif_type, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 28db2ce89..339713145 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170307155042) do
+ActiveRecord::Schema.define(version: 20170309102656) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -515,10 +515,10 @@ ActiveRecord::Schema.define(version: 20170307155042) do
t.string "creator_id"
t.float "distance"
t.boolean "no_processing"
- t.spatial "input_geometry", limit: {:srid=>4326, :type=>"line_string"}
- t.spatial "processed_geometry", limit: {:srid=>4326, :type=>"line_string"}
t.datetime "created_at"
t.datetime "updated_at"
+ t.spatial "input_geometry", limit: {:srid=>4326, :type=>"line_string"}
+ t.spatial "processed_geometry", limit: {:srid=>4326, :type=>"line_string"}
end
create_table "routes", force: true do |t|
@@ -629,6 +629,7 @@ ActiveRecord::Schema.define(version: 20170307155042) do
t.datetime "deleted_at"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "stif_type"
end
add_index "stop_areas", ["name"], :name => "index_stop_areas_on_name"
diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb
index b7295070a..68f7fc621 100644
--- a/lib/stif/reflex_synchronization.rb
+++ b/lib/stif/reflex_synchronization.rb
@@ -147,7 +147,8 @@ module Stif
:area_type => 'TypeOfPlaceRef',
:object_version => 'version',
:zip_code => 'PostalRegion',
- :city_name => 'Town'
+ :city_name => 'Town',
+ :stif_type => 'OBJECT_STATUS'
}.each do |k, v| stop[k] = entry[v] end
if entry['gml:pos']
@@ -157,7 +158,7 @@ module Stif
if stop.changed?
stop.created_at = entry[:created]
- stop.import_xml = entry[:xml]
+ stop.import_xml = entry[:xml]
prop = stop.new_record? ? :imported_count : :updated_count
increment_counts prop, 1
stop.save!
diff --git a/spec/tasks/reflex_rake_spec.rb b/spec/tasks/reflex_rake_spec.rb
index ab1aefc7d..04c5886aa 100644
--- a/spec/tasks/reflex_rake_spec.rb
+++ b/spec/tasks/reflex_rake_spec.rb
@@ -23,6 +23,11 @@ describe 'reflex:sync' do
expect(access.stop_area.name).to eq 'First stopPlace children'
end
+ it 'should store object_status on stif_type attribute' do
+ stop_area = Chouette::StopArea.find_by(name: 'Second StopPlace children')
+ expect(stop_area.stif_type).to eq 'REFERENCE_OBJECT'
+ end
+
it 'should save hierarchy' do
stop_area = Chouette::StopArea.find_by(name: 'First stopPlace children')
expect(stop_area.parent.name).to eq 'First stopPlace'