derf / Travel-Status-DE-DeutscheBahn

Commandline Public Transit Departure Monitor
https://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn
Other
15 stars 3 forks source link

Product Mask doesn't really work as intended with ÖBB profile #11

Closed deingithub closed 4 months ago

deingithub commented 4 months ago

Sorry for another headache around the Austrians :p

The ÖBB profile has the bitmask [qw[ice ice ice regio regio s bus ferry u tram ice ondemand ice]]. The way the mot_mask function is written leads to the "ICE" product mask only containing the last mention of it in the array and overwriting the earlier ones without including them into the mask: https://github.com/derf/Travel-Status-DE-DeutscheBahn/blob/aebdbb0d3f0521503ce46ff679ad2eb822503f0d/lib/Travel/Status/DE/HAFAS.pm#L510-L513

The result is that when requesting with a -m ice filter you only get regiojet departures (mask 1000000000000/4096) instead of regiojet, ec/ic and rj/rjx/ice departures (mask 1000000000101/4101): image

Note also that the way the SCOTTY webapp currently renders its product filter has slightly more differentiation: image

The simplest fix for this would be just giving each category its name and letting API users reconstruct the long distance category as presented on SCOTTY on their own, combining them into one category as the current implementation intends to might also be an option, but would be more complicated and require a rewrite of the mot_mask function.

derf commented 4 months ago

Thanks for the (as always) detailed report!

For now I'll leave it at a simple update of the productbits definition. I think in the long run I'll, at the very least, add backend-specific help texts that explain what the abbreviations inside the mot / productbits list mean. I already know which GitHub issue I can rely on for the ÖBB part :)

deingithub commented 4 months ago

Thanks for the quick fix, the reports are fun to write ^^