Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

journeys(): Canceled journeys are missing in API response (DB) #328

Closed
Krystex opened this issue Nov 10, 2024 · 5 comments
Closed

journeys(): Canceled journeys are missing in API response (DB) #328

Krystex opened this issue Nov 10, 2024 · 5 comments

Comments

@Krystex
Copy link

Krystex commented Nov 10, 2024

Hi all ✋
First of all thanks to the creator and maintainer for this projects, it's immensely helpful!

The problem I encountered: When comparing the results of https://www.bahn.de/ or DB Navigator and hafas-client, somehow canceled journeys are omitted in the API response:

image
const res = await client.journeys('8010085', '8011160', {results: 10, transfers: 0, tickets: true})
for (const journey of res.journeys) {
  const leg = journey.legs[0]
  console.log(`${leg.plannedDeparture} ${leg.line.name}`)
}

results in:

2024-11-10T16:54:00+01:00 EC 172
2024-11-10T18:54:00+01:00 EC 170
2024-11-10T19:54:00+01:00 RJ 256
2024-11-10T20:30:00+01:00 ES 452
2024-11-11T06:00:00+01:00 NJ 456
2024-11-11T06:22:00+01:00 FLX 1230

Am I missing a flag or is the API response malformed?

NOTE: If you read this, the journeys probably don't exist anymore. You can find canceled trips over the DB Verkehrsmeldungen Page

@dabund24
Copy link
Contributor

dabund24 commented Dec 1, 2024

Have you tried modifying the routingMode option? (see https://github.com/public-transport/hafas-client/tree/main/p/db#using-the-routingmode-option )

@derhuerst
Copy link
Member

Indeed, the routingMode option can be used for this. More background: #287.

@Krystex Please re-open if you have additional questions related to this.

@Krystex
Copy link
Author

Krystex commented Dec 7, 2024

Thanks for the help, with routingMode FULL it is working with the hafas-client library!

However I'm actually using the db-rest API and the routingMode parameter is not documented in /journeys and doesn't work when I specify it.

Should I create an issue there? I can try to fix the problem myself but I'm not familiar with the codebase yet.

@derhuerst
Copy link
Member

However I'm actually using the db-rest API and the routingMode parameter is not documented in /journeys and doesn't work when I specify it.

This will get changed with derhuerst/db-rest#46. I will do my best to review & merge it soon, likely on Monday.

@Krystex
Copy link
Author

Krystex commented Dec 8, 2024

No rush, thank you so much for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants