opened
kmadsen
username_0
<!--
Hello and thanks for contributing! To help us diagnose your problem quickly, please:

 - Include a minimal demonstration of the bug, including code, logs, and screenshots.
 - Ensure you can reproduce the bug using the latest release.
 - Only post to report a bug or request a feature; direct all other questions to: https://stackoverflow.com/questions/tagged/mapbox
-->

**Mapbox Navigation SDK version:** 1.2.0-alpha.2

Discovered this issue here https://github.com/mapbox/mapbox-navigation-android/issues/3682

Mode report here https://app.mode.com/editor/mapbox/reports/69d0cdda2582

![Screen Shot 2020-10-23 at 12 02 51 PM](https://user-images.githubusercontent.com/3021882/97043876-031c6600-1528-11eb-945b-120efb29bc99.png)
The depart event distanceremaining is 0. It should be the estimateddistance, in this example it should have been 4480
Telemetry distanceremaining should be the estimateddistance when departing
issue
created
Guardiola31337
username_1
Cc @username_2
comment
created
kmadsen
username_0
Another query added here [3 - sessions with 0 distanceremaining](https://app.mode.com/editor/mapbox/reports/69d0cdda2582)

It looks like it doesn't happen as often, but there is still an issue.
![Screen Shot 2020-11-03 at 3 00 37 PM](https://user-images.githubusercontent.com/3021882/98049848-5d011380-1de5-11eb-8fbe-e8f9b3b1230a.png)

Example session on `1.2.0-alpha.5` where the depart is `0` but should be `6546`
![Screen Shot 2020-11-03 at 3 07 28 PM](https://user-images.githubusercontent.com/3021882/98050359-6179fc00-1de6-11eb-88a0-fb36de292be6.png)
comment
created
kmadsen
username_0
🤔  Also the distance remaining goes up to `16736` in that session. Which is the issue here https://github.com/mapbox/mapbox-navigation-android/issues/3682

Going to look at re-running the query over there because there still seems to be an unreliable distanceremaining
Also linking other similar issues https://github.com/mapbox/navigation-sdks/issues/608
comment
created
kmadsen
username_0
issue used to happn 70% of the time. now it only happens 2% of the time. huge improvement!

going to leave this issue open, can we always set the `distanceremaining` to the `estimateddistance` for the `navigation.depart` event?
comment
created
korshaknn
username_2
I prefer not to do it. Right now we have the single flow to populate each event of any type. If we have any additional changes to any event it will lead to additional issues. 

So, we need to fix `distanceremaining` field. We have the next logic:
`event.distanceRemaining = routeProgress.distanceRemaining`
`event.estimatedDistance = routeProgress.route.distance`

It might be a NN issue that `routeProgress.distanceRemaining` returns `0`.

and one more question:
we have too small values in `distanceCompleted` on `reRoute` : 4, 3, 0, 0.  But time between the events is 64s, 28s, 22s
I guess distance should be bigger. 
I think it happens because when `reRoute` happens we `reset current routeProgress` and wait for a new `routeProgress` which is related to a `newRoute`.
But we are interested in what happens `before` `reRoute`. So, looks like we should not reset `routeProgress` and use it to init `distanceCompleted`. And we will get distance `before` reroute.

@username_1 @username_0 @mskurydin @SiarheiFedartsou
comment