feat: use cursor instead of when if it is defined
#388
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes https://github.com/AtB-AS/kundevendt/issues/19814
Reference discussion: https://mittatb.slack.com/archives/C02EEG7D8EL/p1746604283420249
The message on the issue appears because there are inconsistencies between the result returned by the trip search and get single trip.
When we search trip by entering the address from-to, we get a list of trips. The first page of the trips list result is fetched using
datetimeparameter on the query. While the subsequent page is fetched using thepagecursorparameter on the query.When we select a single trip to see the details, we fetch the details of this single trip using
datetimeparameter, therefore the result can be different.This happens if we select a specific trip on the second page of result (using
pagecursor), then the trip details will be fetched usingdatetimeinstead. Causing different results when fetching some queries (see reference chat on slack).So the solution to fix this is to make the queries consistent across screens. For queries with
pagecursor, fetch the details using thatpagecursor, if it is not defined, use thedatetime.Feel free to let me know if you need more explanation!