1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #12779: Correct arithmetic for converting inches to meters

This commit is contained in:
jeremystretch
2023-06-01 13:21:15 -04:00
parent 9f70407c7d
commit dee4aec62d
2 changed files with 2 additions and 1 deletions

View File

@ -302,7 +302,7 @@ def to_meters(length, unit):
if unit == CableLengthUnitChoices.UNIT_FOOT:
return length * Decimal(0.3048)
if unit == CableLengthUnitChoices.UNIT_INCH:
return length * Decimal(0.3048) * 12
return length * Decimal(0.0254)
raise ValueError(f"Unknown unit {unit}. Must be 'km', 'm', 'cm', 'mi', 'ft', or 'in'.")