mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
remove explicit raise from convert_weight
This commit is contained in:
@@ -81,14 +81,12 @@ module Calculator
|
||||
end
|
||||
|
||||
def convert_weight(value)
|
||||
return 0 unless value
|
||||
return 0 unless value && ["kg", "lb"].include?(preferences[:unit_from_list])
|
||||
|
||||
if preferences[:unit_from_list] == "kg"
|
||||
value / 1000
|
||||
elsif preferences[:unit_from_list] == "lb"
|
||||
value / 453.6
|
||||
else
|
||||
raise "Unknown unit preference"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user