diff options
| author | Vlatka Pavisic | 2017-01-04 14:00:39 +0100 | 
|---|---|---|
| committer | Vlatka Pavisic | 2017-01-04 14:00:39 +0100 | 
| commit | af34cb854255f2893a27e28b11a2601d6af8a725 (patch) | |
| tree | 4da1c8de8b34069a2d816869c46576dc3d98e5a4 /lib | |
| parent | d1e76469119acd0d92cdb65fa8e9a5b61803b3a3 (diff) | |
| parent | c11be6d012dd77101721900168b9acc64db66e49 (diff) | |
| download | chouette-core-af34cb854255f2893a27e28b11a2601d6af8a725.tar.bz2 | |
Merge master
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/stif/reflex_synchronization.rb | 15 | 
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb index f1655c1fc..b620051af 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,13 @@ 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['type'] == 'Quay' ? 'zde' : entry['TypeOfPlaceRef'] +        type = "#{type.to_s}#{method.last}" unless type == 'LDA' +        type.downcase        end        def set_deleted_stop_area @@ -119,7 +126,7 @@ module Stif            :zip_code       => 'PostalRegion',            :city_name      => 'Town'          }.each do |k, v| access[k] = entry[v] end -        access.save if access.changed? && access.valid? +        access.save if access.valid? && access.changed?        end        def create_or_update_stop_area entry @@ -128,7 +135,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'  | 
