aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinhui2016-10-12 14:21:15 +0200
committerXinhui2016-10-12 14:21:15 +0200
commitb1d4597500f07d87aa32518c4f0baef0bdb8363e (patch)
tree1312dda9b6cc3a48c527578c9a5b7a0b3b657c53
parentff6467f636ec6976bd00818e5cb986e43d9b4d3b (diff)
downloadchouette-core-b1d4597500f07d87aa32518c4f0baef0bdb8363e.tar.bz2
Reflex:sync Edit TypeOfPlaceRef condition
Refs #1796
-rw-r--r--app/models/line_referential_sync.rb2
-rw-r--r--app/models/stop_area_referential_sync.rb2
-rw-r--r--lib/stif/reflex_synchronization.rb5
-rw-r--r--spec/tasks/reflex_rake_spec.rb4
4 files changed, 7 insertions, 6 deletions
diff --git a/app/models/line_referential_sync.rb b/app/models/line_referential_sync.rb
index 03fea6a97..a54d61edb 100644
--- a/app/models/line_referential_sync.rb
+++ b/app/models/line_referential_sync.rb
@@ -30,7 +30,7 @@ class LineReferentialSync < ActiveRecord::Base
end
event :successful, after: :log_successful do
- transitions :from => :pending, :to => :successful
+ transitions :from => [:pending, :failed], :to => :successful
end
event :failed, after: :log_failed do
diff --git a/app/models/stop_area_referential_sync.rb b/app/models/stop_area_referential_sync.rb
index ad99dbb8c..4de5f396a 100644
--- a/app/models/stop_area_referential_sync.rb
+++ b/app/models/stop_area_referential_sync.rb
@@ -30,7 +30,7 @@ class StopAreaReferentialSync < ActiveRecord::Base
end
event :successful, after: :log_successful do
- transitions :from => :pending, :to => :successful
+ transitions :from => [:pending, :failed], :to => :successful
end
event :failed, after: :log_failed do
diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb
index 32fcbc531..822a295c0 100644
--- a/lib/stif/reflex_synchronization.rb
+++ b/lib/stif/reflex_synchronization.rb
@@ -48,8 +48,9 @@ module Stif
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"])
+ 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"])
end
def set_deleted_stop_area processed
diff --git a/spec/tasks/reflex_rake_spec.rb b/spec/tasks/reflex_rake_spec.rb
index 2c2b293a2..7a27b49fc 100644
--- a/spec/tasks/reflex_rake_spec.rb
+++ b/spec/tasks/reflex_rake_spec.rb
@@ -14,7 +14,7 @@ describe 'reflex:sync' do
end
it 'should create stopArea on successfull request' do
- expect(Chouette::StopArea.count).to eq 4
+ expect(Chouette::StopArea.count).to eq 6
expect(Chouette::AccessPoint.count).to eq 2
end
@@ -44,7 +44,7 @@ describe 'reflex:sync' do
end
it 'should not create duplicate stop_area' do
- expect(Chouette::StopArea.count).to eq 4
+ expect(Chouette::StopArea.count).to eq 6
expect(Chouette::AccessPoint.count).to eq 2
end