diff options
| author | Xinhui | 2016-10-11 11:48:40 +0200 |
|---|---|---|
| committer | Xinhui | 2016-10-11 11:48:40 +0200 |
| commit | 84fffe95839ebc80f99fa14c25e0646cafc11099 (patch) | |
| tree | cb9280bb04b3ed8b0ac95fd72835ca3ba30f1989 /lib/stif/reflex_synchronization.rb | |
| parent | 29297c03d56314f0b19e7695c4bdeca69413a8a4 (diff) | |
| download | chouette-core-84fffe95839ebc80f99fa14c25e0646cafc11099.tar.bz2 | |
Reflex:sync Fix deleted message && condition on TypeOfPlaceRef
Diffstat (limited to 'lib/stif/reflex_synchronization.rb')
| -rw-r--r-- | lib/stif/reflex_synchronization.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb index dbd733e99..32fcbc531 100644 --- a/lib/stif/reflex_synchronization.rb +++ b/lib/stif/reflex_synchronization.rb @@ -28,6 +28,7 @@ module Stif start = Time.now stop_areas.each do |entry| + next unless is_valid_type_of_place_ref?(method, entry) processed << entry['id'] self.create_or_update_stop_area entry end @@ -42,10 +43,15 @@ module Stif end { imported: Chouette::StopArea.where(deleted_at: nil).count - initial_count, - deleted: self.set_deleted_stop_area(processed.uniq) + deleted: self.set_deleted_stop_area(processed.uniq).size } end + def is_valid_type_of_place_ref? method, entry + return true if method == 'getOR' && ['ZDL', 'ZDE'].include?(entry["TypeOfPlaceRef"]) + return true if method == 'getOP' && ['LDA', 'ZDE'].include?(entry["TypeOfPlaceRef"]) + end + def set_deleted_stop_area processed start = Time.now deleted = Chouette::StopArea.where(deleted_at: nil).pluck(:objectid).uniq - processed |
