poetaster / fahrplan

QT Application for Public transportation
GNU General Public License v2.0
1 stars 7 forks source link

9292.nl: duration miscalculated #8

Closed dyraig closed 2 years ago

dyraig commented 2 years ago

While testing the new beta backend (THANK YOU!), I noticed that the calculation of the duration of the journey is somehow miscalculated. I've seen several cases:

poetaster commented 2 years ago

Sorry to be so late in seeing this. I had noted in #5, that calculations were incorrect. Thanks for reporting!

poetaster commented 2 years ago

Found it:

    if (detail->getItem(detail->itemcount()-1)->train() == "Walk") {
        minutesEnd =  detail->getItem(detail->itemcount()-2)->arrivalDateTime();
    } else {
        minutesEnd =  detail->getItem(detail->itemcount()-1)->arrivalDateTime();
    }
    if (detail->getItem(0)->train() == "Walk") {
        minutesBegin =  detail->getItem(1)->arrivalDateTime();
    } else {
        minutesBegin =  detail->getItem(0)->arrivalDateTime();
    }

notice that departure time is never used

poetaster commented 2 years ago

Oh. dear. It was a bit more complicated. The current state renders all times correctly. But before I do a release, I'd also like to fix earlier and later.

poetaster commented 2 years ago

If you have the time/muse, compile this version.

poetaster commented 2 years ago

https://github.com/poetaster/fahrplan/releases/tag/2.0.43

Contains the fixes.

dyraig commented 2 years ago

Nice, thank you! Still haven't got round to set up an environment where I could compile Sailfish stuff (some point in the future when things have quietened down a bit maybe...), so I'll just be patient. ;)

poetaster commented 2 years ago

Nice, thank you! Still haven't got round to set up an environment where I could compile Sailfish stuff (some point in the future when things have quietened down a bit maybe...), so I'll just be patient. ;)

Testing on builds and reporting is also a great help. Sometimes I miss a report and it takes too long to respond, but I'll do my best! Thanks for reporting!

poetaster commented 2 years ago

Oh, it's up on chum and openrepos :)