Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
3SPA
API
Commits
4403b7a9
Commit
4403b7a9
authored
4 months ago
by
Mathias Nocet
Browse files
Options
Downloads
Patches
Plain Diff
Correcting bug "findRoutesInArea"
parent
455a9558
No related branches found
No related tags found
1 merge request
!4
Bug, Preferred exercise, CI-CD
Pipeline
#24524
passed
4 months ago
Stage: prepare
Stage: test
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/controllers/route.controller.ts
+6
-4
6 additions, 4 deletions
src/controllers/route.controller.ts
src/repositories/route.repository.ts
+22
-17
22 additions, 17 deletions
src/repositories/route.repository.ts
with
28 additions
and
21 deletions
src/controllers/route.controller.ts
+
6
−
4
View file @
4403b7a9
...
...
@@ -38,11 +38,13 @@ export class RouteController {
description
:
'
Bounding coordinates for fetching steps
'
,
})
async
fetchRoutesInArea
(@
Body
()
boundsDto
:
GeographicBoundsDto
)
{
const
{
latMin
,
latMax
,
longMin
,
longMax
}
=
boundsDto
;
return
await
this
.
routeRepository
.
findRoutesInArea
(
boundsDto
.
latMin
,
boundsDto
.
latMax
,
boundsDto
.
longMin
,
boundsDto
.
longMax
,
latMin
,
latMax
,
longMin
,
longMax
,
);
}
...
...
This diff is collapsed.
Click to expand it.
src/repositories/route.repository.ts
+
22
−
17
View file @
4403b7a9
...
...
@@ -30,15 +30,20 @@ export class RouteRepository extends BaseRepository<Route> {
return
await
this
.
route
.
createQueryBuilder
(
'
route
'
)
.
where
(
`route.Path LIKE :latMin
OR route.Path LIKE :latMax
OR route.Path LIKE :longMin
OR route.Path LIKE :longMax`
,
`EXISTS (
SELECT 1
FROM json_each(json_extract(route.path, '$')) as point
WHERE (
CAST(json_extract(point.value, '$[0]') AS FLOAT) BETWEEN :longMin AND :longMax
AND
CAST(json_extract(point.value, '$[1]') AS FLOAT) BETWEEN :latMin AND :latMax
)
)`
,
{
latMin
:
`%
${
latMin
}
%`
,
latMax
:
`%
${
latMax
}
%`
,
longMin
:
`%
${
longMin
}
%`
,
longMax
:
`%
${
longMax
}
%`
,
latMin
,
latMax
,
longMin
,
longMax
,
},
)
.
leftJoinAndSelect
(
'
route.steps
'
,
'
routeStep
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment