Skip to content

Commit 191dbd0

Browse files
author
Keith Klein
committed
Fix overlay showing stale glucose value instead of latest
GetCurrentReadingAsync() used FirstOrDefault() on the ascending-sorted cached readings list, returning the oldest reading in the 10-minute window instead of the newest. Changed to LastOrDefault() so the overlay value matches the graph window.
1 parent d696d8e commit 191dbd0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

DexcomOverlay/Services/DexcomShareClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public DexcomShareClient(string username, string password, string region = "us")
7272
public async Task<GlucoseReading?> GetCurrentReadingAsync(CancellationToken ct = default)
7373
{
7474
var readings = await GetGlucoseReadingsAsync(minutes: 10, maxCount: 1, ct).ConfigureAwait(false);
75-
return readings.FirstOrDefault();
75+
return readings.LastOrDefault();
7676
}
7777

7878
/// <summary>Get glucose readings within the specified time window. Uses cache when possible.</summary>

0 commit comments

Comments
 (0)