mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 15:59:49 +00:00
Navitia: Fix query context builder.
This commit is contained in:
parent
e86fdede13
commit
8dce62c1ab
1 changed files with 15 additions and 4 deletions
|
@ -1077,11 +1077,22 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
|||
else
|
||||
{
|
||||
// Fill context.
|
||||
String prevQueryUri = null;
|
||||
String nextQueryUri = null;
|
||||
final JSONArray links = head.getJSONArray("links");
|
||||
final JSONObject prev = links.getJSONObject(0);
|
||||
final String prevQueryUri = prev.getString("href");
|
||||
final JSONObject next = links.getJSONObject(1);
|
||||
final String nextQueryUri = next.getString("href");
|
||||
for (int i = 0; i < links.length(); ++i)
|
||||
{
|
||||
final JSONObject link = links.getJSONObject(i);
|
||||
final String type = link.getString("type");
|
||||
if (type.equals("prev"))
|
||||
{
|
||||
prevQueryUri = link.getString("href");
|
||||
}
|
||||
else if (type.equals("next"))
|
||||
{
|
||||
nextQueryUri = link.getString("href");
|
||||
}
|
||||
}
|
||||
|
||||
final QueryTripsResult result = new QueryTripsResult(resultHeader, queryUri.toString(), from, null, to, new Context(from, to,
|
||||
prevQueryUri, nextQueryUri), new LinkedList<Trip>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue