fix: remove seconds from uptime, device added, and last discovered display (#120)
Seconds-level precision adds noise without value for these fields. Shows "less than a minute" instead of "0 seconds" for very short durations. Reviewed-on: graham/towerops-web#120
This commit is contained in:
parent
5d87459ecc
commit
3282c664dc
1 changed files with 3 additions and 4 deletions
|
|
@ -936,7 +936,7 @@ defmodule ToweropsWeb.DeviceLive.Show do
|
|||
{weeks, remainder} = seconds_to_weeks(total_seconds)
|
||||
{days, remainder} = seconds_to_days(remainder)
|
||||
{hours, remainder} = seconds_to_hours(remainder)
|
||||
{minutes, seconds} = seconds_to_minutes(remainder)
|
||||
{minutes, _seconds} = seconds_to_minutes(remainder)
|
||||
|
||||
parts =
|
||||
Enum.reject(
|
||||
|
|
@ -944,14 +944,13 @@ defmodule ToweropsWeb.DeviceLive.Show do
|
|||
format_time_part(weeks, "week"),
|
||||
format_time_part(days, "day"),
|
||||
format_time_part(hours, "hour"),
|
||||
format_time_part(minutes, "minute"),
|
||||
format_time_part(seconds, "second")
|
||||
format_time_part(minutes, "minute")
|
||||
],
|
||||
&is_nil/1
|
||||
)
|
||||
|
||||
case parts do
|
||||
[] -> "0 seconds"
|
||||
[] -> "less than a minute"
|
||||
parts -> Enum.join(parts, " ")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue