Open Oxbowatos opened 1 year ago
This is our current query for the private dashboard: https://github.com/Traewelling/traewelling/blob/74d3a988a149219d8371a1b0ff95d0ddc160d133/app/Http/Controllers/Backend/User/DashboardController.php#L19-L37
We sort here only according to the planned departure of the Journey: https://github.com/Traewelling/traewelling/blob/74d3a988a149219d8371a1b0ff95d0ddc160d133/app/Http/Controllers/Backend/User/DashboardController.php#L27
In order for us to aggregate the data correctly directly we would need to do the following sorts in order:
DESC {join}.train_checkins.manual_departure
DESC {join}.train_checkins.{join}.train_stopovers.{real_departure}.
DESC {join}.train_checkins.{join}.train_stopovers.{planned_departure}.
Since our data structure is a bit complex to build a meaningful and performant query for it I would suggest to do the sorting only on the frontend level so that it looks properly sorted to the user.
ER-Diagram with the relevant tables:
Describe the bug If e.g. I checkin in a train which derparting at 7am and I get on a train departing 6:30am but has 1 hour delay, the delayed checkin is sorted under the first checkin.
It also happens on the Global Dashboard and Home Dashboard that it's sorted wrong
To Reproduce Steps to reproduce the behavior:
Expected behavior That the Page sorts the Checkins with the delayed departure time not only the sheduled departure time.
Screenshots If applicable, add screenshots to help explain your problem.
See how its sorted: (Deleted some fields for privacy reason)![grafik](https://user-images.githubusercontent.com/123954576/217467007-4c456628-a154-4ec1-903b-9dfb7e0350a4.png)
Desktop (please complete the following information): Any Browser
Smartphone (please complete the following information): Any Smartphone