Просмотр исходного кода

Fixes #12779: Correct arithmetic for converting inches to meters

jeremystretch 2 лет назад
Родитель
Сommit
dee4aec62d
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 0
      docs/release-notes/version-3.5.md
  2. 1 1
      netbox/utilities/utils.py

+ 1 - 0
docs/release-notes/version-3.5.md

@@ -25,6 +25,7 @@
 * [#12742](https://github.com/netbox-community/netbox/issues/12742) - Object counts dashboard widget should support URL-compatible query filters
 * [#12762](https://github.com/netbox-community/netbox/issues/12762) - Fix GraphiQL UI by reverting graphene-django to earlier version
 * [#12745](https://github.com/netbox-community/netbox/issues/12745) - Escape display text in API-backed selection widgets
+* [#12779](https://github.com/netbox-community/netbox/issues/12779) - Correct arithmetic for converting inches to meters
 
 ---
 

+ 1 - 1
netbox/utilities/utils.py

@@ -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'.")