fix/sensor-value-scientific-notation (#115)
Reviewed-on: graham/towerops-web#115
This commit is contained in:
parent
3e89045f76
commit
6c82a5cfbf
1 changed files with 4 additions and 5 deletions
|
|
@ -1368,13 +1368,12 @@ defmodule ToweropsWeb.DeviceLive.Show do
|
|||
# Get capacity in bps from a sensor (sensor values are in Mbps, convert to bps)
|
||||
defp get_capacity_bps(nil), do: nil
|
||||
|
||||
defp get_capacity_bps(sensor) do
|
||||
if sensor.latest_reading && sensor.latest_reading.value do
|
||||
# Sensor value is in Mbps, convert to bps
|
||||
round(sensor.latest_reading.value * 1_000_000)
|
||||
end
|
||||
defp get_capacity_bps(%{last_value: value}) when is_number(value) do
|
||||
# Sensor last_value is in Mbps (already divided by sensor_divisor), convert to bps
|
||||
round(value * 1_000_000)
|
||||
end
|
||||
|
||||
defp get_capacity_bps(_sensor), do: nil
|
||||
# Group interfaces by type for organized display
|
||||
defp group_interfaces_by_type(interfaces) do
|
||||
interfaces
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue