From 3282c664dc171cc75252e17c78b15194039026ed Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sun, 22 Mar 2026 16:57:32 -0500 Subject: [PATCH] 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: https://git.mcintire.me/graham/towerops-web/pulls/120 --- lib/towerops_web/live/device_live/show.ex | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/towerops_web/live/device_live/show.ex b/lib/towerops_web/live/device_live/show.ex index fde2cf7f..28776991 100644 --- a/lib/towerops_web/live/device_live/show.ex +++ b/lib/towerops_web/live/device_live/show.ex @@ -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