fix projected hit badge on Windows — show after-reset or hit time, not last-refresh time

This commit is contained in:
SuperDooper
2026-05-11 15:07:47 +02:00
parent c90eb7be69
commit b0542d7291
+14 -6
View File
@@ -135,12 +135,20 @@ public partial class PopupWindow : Window
FontSize = 10, Foreground = secondary, VerticalAlignment = VerticalAlignment.Center FontSize = 10, Foreground = secondary, VerticalAlignment = VerticalAlignment.Center
}); });
// Right: "after reset" when 0%, "today HH:MM" when refreshed today // Right: projected limit-hit time, or "after reset" if burn rate won't reach 100% before reset.
string? refreshLabel = limit.UsedPercent == 0 // BurnRate is stored as usedPercent / windowHours, so hoursToFull = remainingPercent / BurnRate.
? "after reset" string? refreshLabel;
: VM.LastUpdated?.Date == DateTime.Today if (limit.BurnRate <= 0)
? "today " + VM.LastUpdated.Value.ToString("h:mm tt") refreshLabel = "after reset";
: null; 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; UIElement timeRight;
if (refreshLabel != null) if (refreshLabel != null)