Skip to content

Commit 6dd63a1

Browse files
authored
Merge pull request #4172 from hove-io/access_points_depth_2
depth=2 for access_points objects
2 parents 0fa8377 + dfe03fb commit 6dd63a1

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

source/jormungandr/jormungandr/scenarios/helper_classes/proximities_by_crowfly.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,8 @@ def _async_request(self):
182182
for mode in self._modes:
183183
object_type = type_pb2.STOP_POINT
184184
filter = None
185-
# if access_point is true, access points are filled in stop points
186-
depth = 3 if self._request["_access_points"] else 2
185+
depth = 2
187186
if mode == fm.FallbackModes.car.name:
188-
depth = 2
189187
object_type = type_pb2.POI
190188
filter = "poi_type.uri=\"poi_type:amenity:parking\""
191189

source/jormungandr/tests/access_points_tests.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def access_point_is_present(access_point_list, access_point_name):
4141
@dataset({"access_points_test": {}})
4242
class TestAccessPoints(AbstractTestFixture):
4343
def test_access_points_with_stop_points(self):
44-
r = self.query_region('stop_points?depth=3')
44+
r = self.query_region('stop_points?depth=2')
4545
assert len(get_not_null(r, 'stop_points')) == 7
4646

4747
for sp in r['stop_points']:
@@ -82,7 +82,7 @@ def test_access_points_with_stop_points(self):
8282
assert ap['traversal_time'] == 26
8383
assert ap['access_point']['access_point_code'] == "access_point_code_4"
8484

85-
# without depth=3
85+
# without depth=2
8686
r = self.query_region('stop_points')
8787
assert len(get_not_null(r, 'stop_points')) == 7
8888

@@ -94,8 +94,15 @@ def test_access_points_with_stop_points(self):
9494
if sp['name'] == 'spC':
9595
assert "access_points" not in sp
9696

97+
def test_access_points_with_stop_points_depth_1(self):
98+
r = self.query_region('stop_points?depth=1')
99+
assert len(get_not_null(r, 'stop_points')) == 7
100+
101+
for sp in r['stop_points']:
102+
assert "access_points" not in sp
103+
97104
def test_access_points_with_places_nearby(self):
98-
response = self.query_region("coords/2.362795;48.872871/places_nearby?depth=3")
105+
response = self.query_region("coords/2.362795;48.872871/places_nearby?depth=2")
99106
assert len(response['places_nearby']) > 0
100107
is_valid_places(response['places_nearby'])
101108

@@ -117,6 +124,15 @@ def test_access_points_with_places_nearby(self):
117124
assert ap['length'] == 10
118125
assert ap['traversal_time'] == 23
119126

127+
def test_access_points_with_places_nearby_depth_1(self):
128+
response = self.query_region("coords/2.362795;48.872871/places_nearby?depth=1")
129+
assert len(response['places_nearby']) > 0
130+
is_valid_places(response['places_nearby'])
131+
sp_places_nearby = [sp for sp in response['places_nearby'] if sp["embedded_type"] == "stop_point"]
132+
assert len(sp_places_nearby) == 6
133+
for pn in sp_places_nearby:
134+
assert "access_points" not in pn['stop_point']
135+
120136
def test_access_points_api(self):
121137
r = self.query_region('access_points')
122138
assert len(get_not_null(r, 'access_points')) == 3

source/type/pb_converter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ void PbCreator::Filler::fill_pb_object(const nt::StopPoint* sp, pbnavitia::StopP
699699
fill(sp->admin_list, stop_point->mutable_administrative_regions());
700700
}
701701
// access points
702-
if (depth > 2) {
702+
if (depth > 1) {
703703
fill_access_points(sp->access_points, stop_point);
704704
}
705705

0 commit comments

Comments
 (0)