Skip to content

Conversation

@Guardiola31337
Copy link
Contributor

@Guardiola31337 Guardiola31337 commented Dec 1, 2021

Description

  • Fixes Events distanceTraveled not being accumulated

Regression from #3540 https://github.com/mapbox/mapbox-navigation-android/pull/3540/files#diff-c5b716f21ea8e298bbe4b1f715880f4d4e8f1a8d4d42fbeb1008f286f0587c55L632-L634

Opening this as a Draft to get initial feedback while doing further testing downstream.

cc @baddleydone @truburt @Pavel-4 @bamx23

@Guardiola31337 Guardiola31337 added bug Defect to be fixed. Core Work related to core navigation and integrations. skip changelog Should not be added into version changelog. labels Dec 1, 2021
@Guardiola31337 Guardiola31337 added this to the v2.1 milestone Dec 1, 2021
@Guardiola31337 Guardiola31337 requested review from a team, RingerJK and korshaknn December 1, 2021 23:04
@Guardiola31337 Guardiola31337 self-assigned this Dec 1, 2021
@Guardiola31337 Guardiola31337 force-pushed the pg-events-wrong-distance-traveled branch 2 times, most recently from cc8214b to 78adb88 Compare December 2, 2021 23:19
@Guardiola31337 Guardiola31337 mentioned this pull request Dec 3, 2021
@Guardiola31337 Guardiola31337 force-pushed the pg-events-wrong-distance-traveled branch from 78adb88 to a2df739 Compare December 3, 2021 22:11
@Guardiola31337
Copy link
Contributor Author

Capturing from @Pavel-4

Seems that issue is resolved (distance travelled is accumulated properly).

This is ready for review 🚀

cc @ve1oxby @baddleydone @truburt

@Guardiola31337 Guardiola31337 marked this pull request as ready for review December 9, 2021 14:09
Copy link

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a couple of nits to address separately if we can.

assertTrue(events[1] is NavigationDepartEvent)
assertTrue(events[2] is NavigationRerouteEvent)
assertTrue(events[3] is NavigationRerouteEvent)
assertEquals(30, (events[3] as NavigationRerouteEvent).distanceCompleted)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertEquals(30, (events[3] as NavigationRerouteEvent).distanceCompleted)
assertEquals(ROUTE_PROGRESS_DISTANCE_TRAVELED * 2, (events[3] as NavigationRerouteEvent).distanceCompleted)

Comment on lines 759 to 762
val dynamicValues = sessionMetadata?.dynamicValues
val currentDistanceTraveled = dynamicValues?.currentDistanceTraveled ?: 0
val accumulatedDistanceTraveled = dynamicValues?.accumulatedDistanceTraveled ?: 0
val distanceCompleted = currentDistanceTraveled + accumulatedDistanceTraveled

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is repeated in multiple places, maybe worth an extension?

updateRoute(anotherRoute, RoutesExtra.ROUTES_UPDATE_REASON_REROUTE)
locationsCollector.flushBuffers()
every { routeProgress.currentState } returns OFF_ROUTE
updateRouteProgress(1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
updateRouteProgress(1)
updateRouteProgress(count = 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Defect to be fixed. Core Work related to core navigation and integrations. skip changelog Should not be added into version changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants