add distance unit test and fix bug reported via crashyltics

This commit is contained in:
Kevin Hester 2020-02-29 07:59:57 -08:00
parent 3e29ebe0c0
commit 49ed2b8e1f
2 changed files with 23 additions and 1 deletions

View file

@ -125,7 +125,7 @@ data class NodeInfo(
fun distanceStr(o: NodeInfo?) = distance(o)?.let { dist ->
when {
dist == 0 -> null // same point
dist < 1000 -> "%.0f m".format(dist)
dist < 1000 -> "%.0f m".format(dist.toDouble())
else -> "%.1f km".format(dist / 1000.0)
}
}