diff options
| author | Luc Donnet | 2018-03-16 15:09:51 +0100 |
|---|---|---|
| committer | Luc Donnet | 2018-03-16 15:09:51 +0100 |
| commit | 6e27953fbf3539da0d0971f762c0a4443c9f8946 (patch) | |
| tree | 884d62e598263190b482626a41e058e96d49657d /lib/stif | |
| parent | 193b85cc7882762d99f412b796c67f9c350172cd (diff) | |
| download | chouette-core-6e27953fbf3539da0d0971f762c0a4443c9f8946.tar.bz2 | |
Fix reflex sync Refs #6141
Diffstat (limited to 'lib/stif')
| -rw-r--r-- | lib/stif/reflex_synchronization.rb | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb index 4eb5bb541..202446da3 100644 --- a/lib/stif/reflex_synchronization.rb +++ b/lib/stif/reflex_synchronization.rb @@ -51,7 +51,7 @@ module Stif stop_areas = results[:Quay] | results[:StopPlace] time = Benchmark.measure do - stop_areas.in_batches.each do |entry| + stop_areas.each do |entry| next unless is_valid_type_of_place_ref?(method, entry) entry['TypeOfPlaceRef'] = self.stop_area_area_type entry, method self.create_or_update_stop_area entry @@ -152,23 +152,19 @@ module Stif def create_or_update_stop_area entry stop = Chouette::StopArea.find_or_create_by(objectid: entry['id'], stop_area_referential: self.defaut_referential ) { - kind: :commercial, - deleted_at: nil, comment: 'Description', - :name 'Name', - :area_type 'TypeOfPlaceRef', - :object_version 'version', - :zip_code 'PostalRegion', - :city_name 'Town', - :stif_type 'OBJECT_STATUS', - longitude: (entry['gml:pos'][:lng] && entry['gml:pos'][:lng]) ? entry['gml:pos'][:lng] : nil, - latitude: (entry['gml:pos'][:lat] && entry['gml:pos'][:lat]) ? entry['gml:pos'][:lat] : nil + name: 'Name', + area_type: 'TypeOfPlaceRef', + object_version: 'version', + zip_code: 'PostalRegion', + city_name: 'Town', + stif_type: 'OBJECT_STATUS', + longitude: (entry['gml:pos'] && entry['gml:pos'][:lng]) ? entry['gml:pos'][:lng] : nil, + latitude: (entry['gml:pos'] && entry['gml:pos'][:lat]) ? entry['gml:pos'][:lat] : nil }.each do |k, v| stop[k] = entry[v] end - # if entry['gml:pos'] - # stop['longitude'] = entry['gml:pos'][:lng] - # stop['latitude'] = entry['gml:pos'][:lat] - # end + stop.kind = :commercial + stop.deleted_at = nil stop.confirmed_at = Time.now if stop.new_record? if stop.changed? |
