From b0542d72912acf96e6d818e29f5db56dc2d6c74d Mon Sep 17 00:00:00 2001 From: SuperDooper <37051355+superdooper86@users.noreply.github.com> Date: Mon, 11 May 2026 15:07:47 +0200 Subject: [PATCH] =?UTF-8?q?fix=20projected=20hit=20badge=20on=20Windows=20?= =?UTF-8?q?=E2=80=94=20show=20after-reset=20or=20hit=20time,=20not=20last-?= =?UTF-8?q?refresh=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- windows/PopupWindow.xaml.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/windows/PopupWindow.xaml.cs b/windows/PopupWindow.xaml.cs index 8b9afc4..476a402 100644 --- a/windows/PopupWindow.xaml.cs +++ b/windows/PopupWindow.xaml.cs @@ -135,12 +135,20 @@ public partial class PopupWindow : Window FontSize = 10, Foreground = secondary, VerticalAlignment = VerticalAlignment.Center }); - // Right: "after reset" when 0%, "today HH:MM" when refreshed today - string? refreshLabel = limit.UsedPercent == 0 - ? "after reset" - : VM.LastUpdated?.Date == DateTime.Today - ? "today " + VM.LastUpdated.Value.ToString("h:mm tt") - : null; + // Right: projected limit-hit time, or "after reset" if burn rate won't reach 100% before reset. + // BurnRate is stored as usedPercent / windowHours, so hoursToFull = remainingPercent / BurnRate. + string? refreshLabel; + if (limit.BurnRate <= 0) + refreshLabel = "after reset"; + else + { + var projectedHit = DateTime.Now.AddHours((100.0 - limit.UsedPercent) / limit.BurnRate); + refreshLabel = projectedHit > limit.ResetDate + ? "after reset" + : projectedHit.Date == DateTime.Today + ? projectedHit.ToString("h:mm tt") + : projectedHit.ToString("d MMM h:mm tt"); + } UIElement timeRight; if (refreshLabel != null)