return empty string for unitName if no scale matches

This commit is contained in:
Andy Brett
2020-08-08 08:36:18 -07:00
parent a2993652c1
commit d7a8873ee9

View File

@@ -48,7 +48,10 @@ angular.module("admin.products").factory "VariantUnitManager", ->
unitScales[0]
@getUnitName: (scale, unitType) ->
@units[unitType][scale]['name']
if @units[unitType][scale]
@units[unitType][scale]['name']
else
''
@unitScales: (unitType) ->
(parseFloat(scale) for scale in Object.keys(@units[unitType])).sort (a, b) ->