Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix health daily movement graph again :-) #2986

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

ticalc-travis
Copy link
Contributor

This just fixes a typo introduced by commit 31fb8f8 which causes the movement daily summary graph to freeze on the “Loading…” screen and print an error to the console due to trying to access the field name “hr” when it should be “day”.

While I was at it, I noticed what I thought might have been a potential out-of-bounds subscripting error in the *PerDay() functions. The array size is 31 (indeces 0…30) but the indeces actually returned by readDailySummaries are 1…31. However, it appears that the graph never displays a partial day's data before it rolls over, so maybe this would never be a problem because presumably the 31st day of the month would not display? It's technically inconsistent with the fact that the hourly funcs dimension the array to 24 rather than 23, though, but since I'm not sure, I decided to leave that alone for now.

@gfwilliams
Copy link
Member

Argh, Thanks for getting this fix in!

If it's really returning 1..31 then yes, I'd imagine we should be setting array size to 32 (and effectively ignoring index 0) - I can't think that it would break anything to do that...

@gfwilliams gfwilliams merged commit e40b799 into espruino:master Aug 29, 2023
1 check passed
@ticalc-travis
Copy link
Contributor Author

That seems to be a good idea, and yes, the graph code for per-day data does seem to expect 1…31 and ignore 0. I initially tried adjusting the code to write to indeces 0…30 instead, but that caused the day labels on the graph to be 1 less than they should, and entry 0 was drawn but couldn't be selected. Array size 32 looks like the safest option.

@gfwilliams
Copy link
Member

Ok, I'll make that change now

matijatosic pushed a commit to matijatosic/BangleApps that referenced this pull request Sep 7, 2023
@ticalc-travis ticalc-travis deleted the health_daily_movement_2 branch October 12, 2023 20:11
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.

2 participants