Fix formatting zeroes

This commit is contained in:
Kirill Kamakin
2022-12-04 19:02:14 +01:00
parent aee1585106
commit 221ab89b86

View File

@@ -97,8 +97,8 @@ class RecipeIngredientsAdapter private constructor(
private fun Double.formatUsingMediantMethod(d: Int = 10, mixed: Boolean = true): String {
val triple = mediantMethod(d, mixed)
return when {
triple.first == 0 -> "${triple.second}/${triple.third}"
triple.second == 0 -> "${triple.first}"
triple.first == 0 -> "${triple.second}/${triple.third}"
else -> "${triple.first} ${triple.second}/${triple.third}"
}
}