fix(path): show non-zero gas/O₂/H₂O rates on loss budget detail
format_number rounds to 1 decimal, so the tiny per-km coefficients (o2_db_km: 0.007 at 10 GHz, gas rate ~0.007 dB/km) all displayed as '0.0'. Added format_small with 4-decimal precision for those fields.
This commit is contained in:
parent
fc82d3f5de
commit
43239dbb15
1 changed files with 7 additions and 7 deletions
|
|
@ -464,6 +464,9 @@ defmodule MicrowavepropWeb.PathLive do
|
||||||
defp format_number(n) when is_float(n), do: :erlang.float_to_binary(n, decimals: 1)
|
defp format_number(n) when is_float(n), do: :erlang.float_to_binary(n, decimals: 1)
|
||||||
defp format_number(n), do: to_string(n)
|
defp format_number(n), do: to_string(n)
|
||||||
|
|
||||||
|
defp format_small(n) when is_float(n), do: :erlang.float_to_binary(n, decimals: 4)
|
||||||
|
defp format_small(n), do: to_string(n)
|
||||||
|
|
||||||
defp format_km_mi(km), do: Microwaveprop.Format.distance_km(km)
|
defp format_km_mi(km), do: Microwaveprop.Format.distance_km(km)
|
||||||
|
|
||||||
defp format_utc_hour(%DateTime{} = dt), do: Calendar.strftime(dt, "%H:%M")
|
defp format_utc_hour(%DateTime{} = dt), do: Calendar.strftime(dt, "%H:%M")
|
||||||
|
|
@ -727,16 +730,13 @@ defmodule MicrowavepropWeb.PathLive do
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3 text-xs opacity-50 space-y-0.5">
|
<div class="mt-3 text-xs opacity-50 space-y-0.5">
|
||||||
<div>
|
<div>
|
||||||
Gas rate: {format_number(
|
Gas rate: {format_small(
|
||||||
Float.round(
|
(@result.loss_budget.o2 + @result.loss_budget.h2o) / max(@result.dist_km, 0.001)
|
||||||
(@result.loss_budget.o2 + @result.loss_budget.h2o) / max(@result.dist_km, 0.001),
|
|
||||||
4
|
|
||||||
)
|
|
||||||
)} dB/km
|
)} dB/km
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
H₂O: {format_number(@result.band_config.h2o_coeff)} dB/km/g ·
|
H₂O: {format_small(@result.band_config.h2o_coeff)} dB/km/g ·
|
||||||
O₂: {format_number(@result.band_config.o2_db_km)} dB/km
|
O₂: {format_small(@result.band_config.o2_db_km)} dB/km
|
||||||
</div>
|
</div>
|
||||||
<%= if @result.conditions do %>
|
<%= if @result.conditions do %>
|
||||||
<div>Abs humidity avg: {format_number(@result.conditions.abs_humidity)} g/m³</div>
|
<div>Abs humidity avg: {format_number(@result.conditions.abs_humidity)} g/m³</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue