Skip to content

Dashboard: show calories left inside the Today ring - #2

Merged
SilverCrocus merged 2 commits into
mainfrom
dashboard-remaining-calories
Nov 6, 2026
Merged

SilverCrocus merged 2 commits into
mainfrom
dashboard-remaining-calories

Conversation

@SilverCrocus

@SilverCrocus SilverCrocus commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

What and why

The dashboard's Today card showed eaten / target, so seeing what was left meant doing the subtraction yourself. The empty centre of the ring now shows it at a glance:

  • Under target: 1548 kcal left
  • Past target: 252 kcal over (the ring already turns red there)
  • Nothing logged yet: the full target, e.g. 2633 kcal left

Eaten and target are each rounded before subtracting, the same way the figures beside the ring are, so the number always matches them, in kcal or kJ. Checked in the web preview at phone width: the label sits in the exact centre of the ring, and a five-digit kJ value (51px) still fits inside it (71px).

Fixes #1

Checklist

  • cargo fmt, cargo clippy --all-targets -- -D warnings and cargo test pass (plus the wasm32 check)
  • Screenshots attached for UI changes
  • Docs updated if behaviour or an algorithm changed (no algorithm changed; FEATURES.md already covers the dashboard summary)
  • Nothing copied from another app (see the clean-room rule in CONTRIBUTING.md)

The Today card showed eaten / target, leaving you to work out what was
left. The ring's empty centre now shows the calories left, or how far
over once you pass the target. It only reads "over" once that rounds to
at least 1, so a fraction of a calorie past the target shows "0 left".

Fixes #1
The ring rounded the difference, while "eaten / target" rounds each
value, so they could disagree by 1: 1000.4 of 1894.6 showed
"1000 / 1895" but 894 left. Round each value first, ties to even as
`{:.0}` does, so the ring always matches.
@SilverCrocus
SilverCrocus merged commit eeaf642 into main Nov 6, 2026
1 check passed
@SilverCrocus
SilverCrocus deleted the dashboard-remaining-calories branch November 6, 2026 05:50
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.

Add remaining calories to homepage

1 participant