From 0a0caa9533d0753e965c530d70c7e02ed1e52613 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Thu, 6 Aug 2026 13:25:54 -0400 Subject: [PATCH] fix(ui): round progress percentage to 2 decimals on progress page The large percentage badge displayed the raw float value unformatted (e.g. 1.523456789%). Now uses %.2f for a clean display (e.g. 1.52%). --- templates/progress.templ | 4 ++-- templates/progress_templ.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/progress.templ b/templates/progress.templ index 46a2f28..85b9131 100644 --- a/templates/progress.templ +++ b/templates/progress.templ @@ -60,7 +60,7 @@ templ Progress(user User, progressData []handlers.ProgressWithMedia, errorMessag

by { item.Author }

} - { item.ProgressPercentage }% + { fmt.Sprintf("%.2f", item.ProgressPercentage) }%
@@ -75,7 +75,7 @@ templ Progress(user User, progressData []handlers.ProgressWithMedia, errorMessag if item.EstimatedPages > 0 { { fmt.Sprintf("Page %d of %d (est.)", item.CurrentPage, item.EstimatedPages) } } else { - { fmt.Sprintf("%.1f%%", item.ProgressPercentage) } + { fmt.Sprintf("%.2f%%", item.ProgressPercentage) } } } else { { fmt.Sprintf("%d / %d", item.CurrentPage, item.TotalPages) } diff --git a/templates/progress_templ.go b/templates/progress_templ.go index cf62bd5..cc4b862 100644 --- a/templates/progress_templ.go +++ b/templates/progress_templ.go @@ -134,9 +134,9 @@ func Progress(user User, progressData []handlers.ProgressWithMedia, errorMessage return templ_7745c5c3_Err } var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(item.ProgressPercentage) + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%.2f", item.ProgressPercentage)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/progress.templ`, Line: 63, Col: 106} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/progress.templ`, Line: 63, Col: 127} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -172,7 +172,7 @@ func Progress(user User, progressData []handlers.ProgressWithMedia, errorMessage } } else { var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%.1f%%", item.ProgressPercentage)) + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%.2f%%", item.ProgressPercentage)) if templ_7745c5c3_Err != nil { return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/progress.templ`, Line: 78, Col: 62} }