Bug 1848658 - Remove fakespot shopping adjusted rating toFloatOrNull call

fenix/120.0
Cathy Lu 9 months ago committed by mergify[bot]
parent a840d621a8
commit f6696b57cd

@ -33,7 +33,7 @@ private fun GeckoProductAnalysis.toProductReview(): ProductReviewState =
ProductReviewState.Error.GenericError
}
} else {
val mappedRating = adjustedRating?.toFloatOrNull()
val mappedRating = adjustedRating?.toFloat()
val mappedGrade = grade?.toGrade()
val mappedHighlights = highlights?.toHighlights()?.toSortedMap()
@ -80,17 +80,5 @@ private fun Highlight.highlightsForType(highlightType: HighlightType) =
HighlightType.COMPETITIVENESS -> competitiveness
}?.map { it.surroundWithQuotes() }
/**
* GeckoView sets 0.0 as default instead of null for adjusted rating. This maps 0.0 to null making
* it easier for the UI layer to decide whether to display a UI element based on the presence of
* value.
*/
private fun Double.toFloatOrNull(): Float? =
if (this == 0.0) {
null
} else {
toFloat()
}
private fun String.surroundWithQuotes(): String =
"\"$this\""

Loading…
Cancel
Save