Distance: Don't return type in interval bounds

Summary: We were returning `"type":"value"` for each bound.

Reviewed By: blandinw

Differential Revision: D7011092

fbshipit-source-id: d2b5c4d28505a1f24749ecc3975e04c7ba7a6fe1
This commit is contained in:
Julien Odent 2018-02-16 11:23:14 -08:00 committed by Facebook Github Bot
parent 43079e7113
commit 55b0d1d437
2 changed files with 10 additions and 7 deletions

View File

@ -118,14 +118,18 @@ data AmountOfMoneyData = AmountOfMoneyData
instance Resolve AmountOfMoneyData where
type ResolvedValue AmountOfMoneyData = AmountOfMoneyValue
resolve _ AmountOfMoneyData {value = Nothing, minValue = Nothing, maxValue = Nothing} = Nothing
resolve _ AmountOfMoneyData {value = Nothing, minValue = Nothing
, maxValue = Nothing} = Nothing
resolve _ AmountOfMoneyData {value = Just value, currency} =
Just $ simple currency value
resolve _ AmountOfMoneyData {value = Nothing, currency = c, minValue = Just from, maxValue = Just to} =
resolve _ AmountOfMoneyData {value = Nothing, currency = c
, minValue = Just from, maxValue = Just to} =
Just $ between c (from, to)
resolve _ AmountOfMoneyData {value = Nothing, currency = c, minValue = Just v, maxValue = Nothing} =
resolve _ AmountOfMoneyData {value = Nothing, currency = c
, minValue = Just v, maxValue = Nothing} =
Just $ above c v
resolve _ AmountOfMoneyData {value = Nothing, currency = c, minValue = Nothing, maxValue = Just v} =
resolve _ AmountOfMoneyData {value = Nothing, currency = c
, minValue = Nothing, maxValue = Just v} =
Just $ under c v
data IntervalDirection = Above | Under

View File

@ -75,9 +75,8 @@ data SingleValue = SingleValue
instance ToJSON SingleValue where
toJSON (SingleValue unit value) = object
[ "type" .= ("value" :: Text)
, "value" .= value
, "unit" .= unit
[ "value" .= value
, "unit" .= unit
]
data DistanceValue