fix projected hit badge on Windows — show after-reset or hit time, not last-refresh time
This commit is contained in:
@@ -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.
|
||||||
|
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"
|
? "after reset"
|
||||||
: VM.LastUpdated?.Date == DateTime.Today
|
: projectedHit.Date == DateTime.Today
|
||||||
? "today " + VM.LastUpdated.Value.ToString("h:mm tt")
|
? projectedHit.ToString("h:mm tt")
|
||||||
: null;
|
: projectedHit.ToString("d MMM h:mm tt");
|
||||||
|
}
|
||||||
|
|
||||||
UIElement timeRight;
|
UIElement timeRight;
|
||||||
if (refreshLabel != null)
|
if (refreshLabel != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user