Skip to content

Commit

Permalink
Merge pull request #191 from kevinkreiser/kk_cosmetic
Browse files Browse the repository at this point in the history
cosmetic updates for locate service changes
  • Loading branch information
drewda committed Oct 7, 2015
2 parents 2858348 + a95fe99 commit 6047a70
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 54 deletions.
2 changes: 1 addition & 1 deletion app/models/stop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def self.conflate_with_osm(stops)
end
tyr_locate_response = TyrService.locate(locations: locations)
group.each_with_index do |stop, index|
way_id = tyr_locate_response[index][:ways][0][:way_id]
way_id = tyr_locate_response[index][:edges][0][:way_id]
stop_tags = stop.tags.try(:clone) || {}
stop_tags[:osm_way_id] = way_id
stop.update(tags: stop_tags)
Expand Down
66 changes: 51 additions & 15 deletions spec/services/tyr_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,23 @@
expect(response).to eq [
{
input_lon: -122.413605,
ways: [{
correlated_lon: -122.413605,
way_id: 8917801,
correlated_lat: 37.775692
}],
node: nil,
edges:[
{
way_id: 8917801,
correlated_lat: 37.775589,
side_of_street: "left",
percent_along: 0.39047,
correlated_lon: -122.413521
},
{
way_id: 8917801,
correlated_lat: 37.775589,
side_of_street: "right",
percent_along: 0.60953,
correlated_lon: -122.413521
}
],
input_lat: 37.775692
}
]
Expand All @@ -42,19 +54,43 @@
expect(response).to eq [
{
input_lon: -122.413605,
ways: [{
correlated_lon: -122.413605,
way_id: 8917801,
correlated_lat: 37.775692
}],
node: nil,
edges: [
{
way_id: 8917801,
correlated_lat: 37.775589,
side_of_street: "left",
percent_along: 0.39047,
correlated_lon: -122.413521
},
{
way_id: 8917801,
correlated_lat: 37.775589,
side_of_street: "right",
percent_along: 0.60953,
correlated_lon: -122.413521
}
],
input_lat: 37.775692
},{
input_lon: -73.990471,
ways: [{
correlated_lon: -73.990471,
way_id: 5671311,
correlated_lat: 40.744549
}],
node: nil,
edges: [
{
way_id: 5671311,
correlated_lat: 40.744427,
side_of_street: "right",
percent_along: 0.87621,
correlated_lon: -73.990524
},
{
way_id: 5671311,
correlated_lat: 40.744427,
side_of_street: "left",
percent_along: 0.12379,
correlated_lon: -73.990524
}
],
input_lat: 40.744549
}
]
Expand Down
20 changes: 6 additions & 14 deletions spec/support/vcr_cassettes/tyr_one_location.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 6 additions & 14 deletions spec/support/vcr_cassettes/tyr_two_locations.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 34 additions & 10 deletions spec/workers/conflate_stops_with_osm_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,44 @@
{
input_lon: -122.413601,
input_lat: 37.775692,
ways: [{
correlated_lon: -122.413601,
way_id: 8917801,
correlated_lat: 37.775692
}]
node: nil,
edges: [
{
correlated_lon: -122.413601,
way_id: 8917801,
correlated_lat: 37.775692,
side_of_street: 'right',
percent_along: 0.63
},
{
correlated_lon: -122.413601,
way_id: 8917801,
correlated_lat: 37.775692,
side_of_street: 'left',
percent_along: 0.37
}
]
},
{
input_lon: -122.396431,
input_lat: 37.793152,
ways: [{
correlated_lon: -122.413601,
way_id: 8917802,
correlated_lat: 37.775692
}]
node: nil,
edges: [
{
correlated_lon: -122.413601,
way_id: 8917802,
correlated_lat: 37.775692,
side_of_street: 'right',
percent_along: 0.82
},
{
correlated_lon: -122.413601,
way_id: 8917802,
correlated_lat: 37.775692,
side_of_street: 'left',
percent_along: 0.18
}
]
}
])
worker = ConflateStopsWithOsmWorker.new
Expand Down

0 comments on commit 6047a70

Please sign in to comment.