Skip to content

Fix off-by-one reading count in glucose distribution report - #8812

Open
cpruijsen wants to merge 2 commits into
nightscout:masterfrom
cpruijsen:fix/issue-7659
Open

cpruijsen wants to merge 2 commits into
nightscout:masterfrom
cpruijsen:fix/issue-7659

Conversation

@cpruijsen

Copy link
Copy Markdown

Corrects the glucose reading count in lib/report_plugins/glucosedistribution.js so Distribution counts the first reading once. For a complete day with five-minute readings, Distribution now shows 288 readings instead of 289, the same as Daily Stats.

The duration loop includes the first real interval to preserve daily and hourly change calculations. Existing gap interpolation remains unchanged.

Fixes #7659.

tests/glucosedistribution.test.js fails on the merge-base (13 instead of 12 readings, and 2 instead of 1) and passes with the fix. The tests also check daily and hourly change values.
The full suite remains unverified because MongoDB was unavailable.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Difference of 1 in the number of BG-readings between reports Daily Stats and Distribution.

1 participant