Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
8103acf9
Commit
8103acf9
authored
Jun 05, 2021
by
Volker Krause
Browse files
Don't attempt departure/journey queries if the location query failed
Those are bound to fail due to invalid GraphQL parameters then.
parent
e91e1fb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/backends/opentripplannergraphqlbackend.cpp
View file @
8103acf9
...
...
@@ -97,6 +97,10 @@ bool OpenTripPlannerGraphQLBackend::queryLocation(const LocationRequest &req, Lo
bool
OpenTripPlannerGraphQLBackend
::
queryStopover
(
const
StopoverRequest
&
req
,
StopoverReply
*
reply
,
QNetworkAccessManager
*
nam
)
const
{
if
(
!
req
.
stop
().
hasCoordinate
())
{
return
false
;
}
auto
gqlReq
=
graphQLRequest
();
gqlReq
.
setQueryFromFile
(
graphQLPath
(
QStringLiteral
(
"departure.graphql"
)));
gqlReq
.
setVariable
(
QStringLiteral
(
"lat"
),
req
.
stop
().
latitude
());
...
...
@@ -127,6 +131,10 @@ bool OpenTripPlannerGraphQLBackend::queryStopover(const StopoverRequest &req, St
bool
OpenTripPlannerGraphQLBackend
::
queryJourney
(
const
JourneyRequest
&
req
,
JourneyReply
*
reply
,
QNetworkAccessManager
*
nam
)
const
{
if
(
!
req
.
from
().
hasCoordinate
()
||
!
req
.
to
().
hasCoordinate
())
{
return
false
;
}
auto
gqlReq
=
graphQLRequest
();
gqlReq
.
setQueryFromFile
(
graphQLPath
(
QStringLiteral
(
"journey.graphql"
)));
gqlReq
.
setVariable
(
QStringLiteral
(
"fromLat"
),
req
.
from
().
latitude
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment