Skip to content

Streak strip off-by-one fix + carry saved favorite names through logging#203

Merged
d3mocide merged 4 commits into
mainfrom
claude/determined-edison-p3eulk
Jun 14, 2026
Merged

Streak strip off-by-one fix + carry saved favorite names through logging#203
d3mocide merged 4 commits into
mainfrom
claude/determined-edison-p3eulk

Conversation

@d3mocide

@d3mocide d3mocide commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Two related Today-screen fixes on this branch.

1. Streak strip lit an extra past day

The Current Streak widget lit a day that was never on track (e.g. Friday glowing at a 1-day streak). StreakStrip.tsx only receives days (the streak length) and inferred past on-track squares as offset <= days, but the backend streak count includes today when today is on track — so it double-counted today and lit one extra past day. Fix subtracts today's own contribution before lighting past squares.

2. Saved favorite names now flow into the meal name field

Anytime a meal is pulled from a saved favorite, its name now follows it instead of being dropped:

  • Quick-log: GET /log/meals/frequent returns a name per suggestion, resolved from the saved favorite (via favorite_id) or a meaningful raw_input (generic "Manual log" stays unnamed). QuickTab shows it as the card title (ingredient list demoted to a subtitle), and Re-log prepopulates the name field.
  • Budget checker: selecting a favorite in NutritionCalculatorCard now sets the meal name.
  • Search: the LogSheet food search now surfaces matching favorites at the top of results (★, kcal); tapping one adds all its items and fills the name — this implements the "surface favorites as top results" idea.

Name fields are only prepopulated when empty, so typed input is never clobbered.

Testing

  • Backend: mypy luma --ignore-missing-imports clean; pytest 183 passed (added 2 cases for the new name field on /log/meals/frequent)
  • Frontend: pnpm type-check clean, pnpm lint exit 0, pnpm test 97 passed

Note on scope

The favorites-in-search treatment was added to the LogSheet search box (the primary one). I can extend the same merge to the budget checker's search field if you'd like — say the word.

https://claude.ai/code/session_0143KxF5kFKX9bAkdeUGJxYz

claude added 2 commits June 14, 2026 03:33
The week strip only receives the streak length and inferred on-track past
days as offsets 1..days. Because the backend streak count includes today
when today is on track, this double-counts today and lights one extra past
day that never met the threshold (e.g. yesterday glowing at a 1-day streak).

Subtract today's own contribution from the streak before deciding how many
past squares to light, so past days reflect the actual contiguous run.
Whenever a meal is pulled from a saved favorite, its name now flows into the
meal name field instead of being dropped:

- /log/meals/frequent returns a `name` per suggestion, resolved from the saved
  favorite (via favorite_id) or a meaningful raw_input. QuickTab shows it as the
  card title and a Re-log prepopulates the name field.
- Budget checker (NutritionCalculatorCard) sets the meal name when a favorite is
  selected.
- LogSheet search now surfaces matching favorites at the top of results; tapping
  one adds its items and fills the name.

Name fields are only prepopulated when empty so typed input is never clobbered.
@d3mocide d3mocide changed the title Fix streak strip lighting an extra past day Streak strip off-by-one fix + carry saved favorite names through logging Jun 14, 2026
claude added 2 commits June 14, 2026 03:54
Extend the favorites-at-top-of-search treatment to the two remaining meal
builders: the Today budget checker (NutritionCalculatorCard) and the meals-page
Calculator tab (which reuses IngredientBuilder). Matching favorites appear above
food results; tapping one drops in its items and prefills the meal name when
empty.

The meals-page Foods tab is intentionally left as a browse-only nutrition
reference — it has no meal-building action for a favorite to feed.
Coordinate and enrich the rings/gauges card (Tier A+B) within the brand's
restraint (BRAND-GUIDE §12 — no springs/shimmer/large entrances):

- ActivityRings: fills animate on mount AND on data change (stroke-dashoffset
  now transitions, so logging a meal smoothly advances the arc instead of
  snapping), staggered outer→inner. Adds a lit progress-cap bead riding each
  arc's leading edge and per-ring colored drop-shadow glow.
- MacroBar: new component for the calorie/protein gauges — animates width from
  empty on mount and transitions on change, matching the rings' curve/duration.
  Replaces the duplicated inline bars in both desktop and mobile layouts.
- usePrefersReducedMotion hook + reduced-motion guards: motion collapses to the
  final state instantly when the user prefers reduced motion.
- Motion tokens (--ease-ring, --duration-slow) centralized in index.css.

No new dependencies (pure SVG/CSS + rAF).
@d3mocide d3mocide marked this pull request as ready for review June 14, 2026 04:09
@d3mocide d3mocide merged commit 21cbe9b into main Jun 14, 2026
4 checks passed
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