commit d02655f6e7945cd8be2f8d4dddeb3a9695f39da6
parent 1522660a66dbb260c3db4d5988cc7428a82e0d1b
Author: Damian Myrda <damian@prime8.dev>
Date: Mon, 26 Oct 2026 19:32:50 +0000
wakatime: honest wording, '3.4k hrs logged'
Diffstat:
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/internal/config/site.go b/internal/config/site.go
@@ -5,7 +5,7 @@ const (
SiteURL = "https://" + SiteDomain
// WakaTimeUser is the WakaTime username whose public all-time total
- // ("N+ hrs coded") shows in the web status bar and the SSH TUI footer.
+ // ("3.4k hrs logged") shows in the web status bar and the SSH TUI footer.
// Empty turns the feature off: no network calls, no stat, no /api/wakatime.
WakaTimeUser = "moncheeta"
)
diff --git a/internal/external/wakatime.go b/internal/external/wakatime.go
@@ -52,7 +52,7 @@ type publicStatsResponse struct {
} `json:"data"`
}
-// FetchTotal returns the all-time total ("N+ hrs coded"). It returns nil, nil
+// FetchTotal returns the all-time total ("3.4k hrs logged"). It returns nil, nil
// when no user is configured or while WakaTime is still computing the stats;
// on a failed fetch it serves the last good value when there is one.
func (s *WakaTime) FetchTotal() (*WakaTimeStats, error) {
@@ -127,5 +127,10 @@ func (s *WakaTime) fetchAllTimeSeconds() (float64, bool, error) {
}
func formatTotalHours(totalSeconds float64) string {
- return fmt.Sprintf("%d+ hrs coded", int(totalSeconds/3600))
+ hours := int(totalSeconds / 3600)
+ if hours < 1000 {
+ return fmt.Sprintf("%d hrs logged", hours)
+ }
+ // Truncate, never round up: 3447 h reads 3.4k.
+ return fmt.Sprintf("%d.%dk hrs logged", hours/1000, hours%1000/100)
}
diff --git a/internal/external/wakatime_test.go b/internal/external/wakatime_test.go
@@ -35,7 +35,7 @@ func TestFetchTotalParsesPublicStats(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if stats == nil || stats.AllTime.TotalText != "3412+ hrs coded" {
+ if stats == nil || stats.AllTime.TotalText != "3.4k hrs logged" {
t.Fatalf("stats = %+v", stats)
}
if gotPath != "/users/@moncheeta/stats/all_time" {
@@ -120,7 +120,7 @@ func TestFetchTotalServesStaleWhilePendingOrFailing(t *testing.T) {
mode.Store(m)
w.cache.Delete(wakaTimeKey)
stats, err := w.FetchTotal()
- if err != nil || stats == nil || stats.AllTime.TotalText != "10+ hrs coded" {
+ if err != nil || stats == nil || stats.AllTime.TotalText != "10 hrs logged" {
t.Fatalf("%s: got %+v, %v; want stale value", m, stats, err)
}
}