diff options
| author | Xinhui | 2017-03-09 12:10:18 +0100 | 
|---|---|---|
| committer | Xinhui | 2017-03-09 12:10:18 +0100 | 
| commit | f4c5751a4037f52ab1d73fc201e81ba07798ecd4 (patch) | |
| tree | fdc4cba66793aa0e54ccd3aba8b564b8b2c617e3 | |
| parent | b1351a0ce13e1c86584640a204ed8e1c32f5dd36 (diff) | |
| download | chouette-core-f4c5751a4037f52ab1d73fc201e81ba07798ecd4.tar.bz2 | |
Sync Reflex ObjectStatus into StopArea stif_type
Refs #2737
| -rw-r--r-- | Gemfile.lock | 2 | ||||
| -rw-r--r-- | db/migrate/20170309102656_add_stif_type_to_stop_area.rb | 5 | ||||
| -rw-r--r-- | db/schema.rb | 7 | ||||
| -rw-r--r-- | lib/stif/reflex_synchronization.rb | 5 | ||||
| -rw-r--r-- | spec/tasks/reflex_rake_spec.rb | 5 | 
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' | 
