Fix format_response_time crash on non-numeric input
This commit is contained in:
parent
61f803afe5
commit
06f9b7e60b
1 changed files with 3 additions and 2 deletions
|
|
@ -172,8 +172,9 @@ defmodule ToweropsWeb.SiteLive.Show do
|
|||
end
|
||||
|
||||
defp format_response_time(nil), do: "—"
|
||||
defp format_response_time(ms) when ms < 1, do: "<1ms"
|
||||
defp format_response_time(ms), do: "#{round(ms)}ms"
|
||||
defp format_response_time(ms) when is_number(ms) and ms < 1, do: "<1ms"
|
||||
defp format_response_time(ms) when is_number(ms), do: "#{round(ms)}ms"
|
||||
defp format_response_time(_), do: "—"
|
||||
|
||||
defp change_size_label(size) when size < 100, do: "Small"
|
||||
defp change_size_label(size) when size < 500, do: "Medium"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue