aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stif/reflex_synchronization.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stif/reflex_synchronization.rb')
-rw-r--r--lib/stif/reflex_synchronization.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb
index c62cbe94f..9408d2c7b 100644
--- a/lib/stif/reflex_synchronization.rb
+++ b/lib/stif/reflex_synchronization.rb
@@ -45,8 +45,9 @@ module Stif
time = Benchmark.measure do
stop_areas.each do |entry|
next unless is_valid_type_of_place_ref?(method, entry)
- self.processed << entry['id']
+ entry['TypeOfPlaceRef'] = self.stop_area_area_type entry, method
self.create_or_update_stop_area entry
+ self.processed << entry['id']
end
end
log_processing_time("Create or update StopArea", time.real)
@@ -66,7 +67,15 @@ module Stif
def is_valid_type_of_place_ref? method, entry
return true if entry["TypeOfPlaceRef"].nil?
return true if method == 'getOR' && ['ZDL', 'LDA', 'ZDE'].include?(entry["TypeOfPlaceRef"])
- return true if method == 'getOP' && ['ZDE'].include?(entry["TypeOfPlaceRef"])
+ return true if method == 'getOP' && ['ZDE', 'ZDL'].include?(entry["TypeOfPlaceRef"])
+ end
+
+ def stop_area_area_type entry, method
+ type = entry['TypeOfPlaceRef']
+ if type
+ type = "#{type}#{method.last}" unless type == 'LDA'
+ type.downcase
+ end
end
def set_deleted_stop_area
@@ -128,7 +137,7 @@ module Stif
stop.stop_area_referential = self.defaut_referential
{
:name => 'Name',
- :area_type => 'type',
+ :area_type => 'TypeOfPlaceRef',
:object_version => 'version',
:zip_code => 'PostalRegion',
:city_name => 'Town'