barbarosso / irail-web-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leave out the typeOfTransport parameter, so iRail chooses the right one automatically

Bertware opened this issue · comments

Hi,

While I didn't have the time yet to try out this web-app myself, I noticed that you send the typeOfTransport parameter to iRail, which is always hardcoded to 'trains'. (here: https://github.com/barbarosso/irail-web-app/blob/master/services/irail.js#L25)

I suggest that you leave out that parameter (so the iRail API handles it), or to use some logic to determine the right type of transport depending on the stations.
iRail gets its data from the NMBS, and unfortunately the NMBS hides local trains sometimes if there is a faster high-speed alternative. In other words, sometimes local trains are missing because there is a Thalys, ICE, ... connection which is faster, even though normal travellers can't take those (you need a special ticket). You can read the original issue here: iRail/iRail#356 .
How iRail handles this: https://github.com/iRail/iRail/blob/master/api/data/NMBS/connections.php#L142

If you are searching between Belgian stations you should use noInternationalTrains to prevent this. You can either leave out the parameter so iRail automaticity determines the right type based on the country in which the station lies, or you can implement such logic yourself.

It's a small finishing touch, but given the small time needed to fix it, it seems best to implement a solution.

If something isn't 100% clear, feel free to ask! Hope this helps with the development of your webapp.

Hi,
Thank you for reporting, we are still in the setup phase of the web app.
So it's good we can tackle this issue before it arises.

Regards
Pascal