Select all entrances for results in one query

This commit is contained in:
Emily Love Watson
2025-08-21 11:35:23 -05:00
parent e916d27b7c
commit d0ad65f696
9 changed files with 72 additions and 92 deletions

View File

@@ -36,7 +36,9 @@ Feature: Object details
| W | 429210603 | 1 |
Then a HTTP 200 is returned
And the result is valid json
And the result has attributes entrances
And the result contains array field entrances where element 0 contains
| osm_id | type | lat | lon |
| 6580031131 | yes | 47.2489382 | 9.5284033 |
Scenario: Details with linkedplaces
When sending v1/details

View File

@@ -9,8 +9,8 @@ Feature: Entrance nodes are recorded
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
| id | nodes |
| 1 | 1, 2, 3, 4, 1 |
When importing
Then placex contains exactly
| object | place_id |
@@ -18,63 +18,68 @@ Feature: Entrance nodes are recorded
Then place_entrance contains exactly
| place_id | entrances |
When updating places
| osm | class | type | geometry |
| N10 | entrance | main | 1 |
| osm | class | type | geometry |
| N1 | entrance | main | 1 |
| W1 | building | yes | (1,2,3,4,1) |
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': None}] |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 1, 'extratags': None}] |
Scenario: A building with a updated entrance node
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
| N10 | barrier | gate | 1 |
| osm | class | type | geometry |
| N1 | barrier | gate | 1 |
| W1 | building | yes | (1,2,3,4,1) |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
| id | nodes |
| 1 | 1, 2, 3, 4, 1 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
| N10 | 2 |
| N1 | 1 |
| W1 | 2 |
Then place_entrance contains exactly
| place_id | entrances |
When updating places
| osm | class | type | geometry |
| N10 | entrance | main | 1 |
| osm | class | type | geometry |
| N1 | entrance | main | 1 |
| W1 | building | yes | (1,2,3,4,1) |
Then placex contains exactly
| object | place_id |
| W1 | 1 |
| N10 | 2 |
| N1 | 1 |
| W1 | 2 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': None}] |
| 2 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 1, 'extratags': None}] |
Scenario: A building with a removed entrance
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry |
| W1 | building | yes | (1,2,3,4,1) |
| N10 | entrance | main | 1 |
| osm | class | type | geometry |
| N1 | entrance | main | 1 |
| W1 | building | yes | (1,2,3,4,1) |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
| id | nodes |
| 1 | 1, 2, 3, 4, 1 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': None}] |
When marking for delete N10
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 1, 'extratags': None}] |
When marking for delete N1
And updating places
| osm | class | type | geometry |
| W1 | building | yes | (2,3,4,2) |
Then placex contains exactly
| object | place_id |
| W1 | 1 |