Skip to content

feat: clarify portion and date editing in the nutrition diary - #1333

Open
matt8s wants to merge 3 commits into
wger-project:masterfrom
matt8s:diary-portion-date-editing
Open

matt8s wants to merge 3 commits into
wger-project:masterfrom
matt8s:diary-portion-date-editing

Conversation

@matt8s

@matt8s matt8s commented Oct 30, 2026

Copy link
Copy Markdown

Proposed Changes

Make editing an existing diary entry an explicit portion-and-date operation.

  • Add a keyboard-accessible Edit button and show the food as read-only while editing.
  • PATCH only amount, datetime, and weight_unit, preserving the entry's food, plan, and meal.
  • Send an explicit null unit when switching to grams, and preserve unresolved serving-unit IDs until the user changes the unit.
  • Validate decimal amounts and retain the form and its error message after a failed save. Disable dismissal while a save is pending.

Related Issue(s)

See wger-project/flutter#1406 for the companion mobile editing proposal.

Validation

  • All 122 nutrition tests passed; focused edit/API/action tests also passed in UTC.
  • TypeScript checks passed. Lint passed with two existing unrelated warnings.
  • Chrome smoke checks covered keyboard Edit, comma decimals, grams clearing, pending and failed saves, actual calendar selection, cancellation, saved-state reopening, and reachable controls at a 390-pixel viewport.
  • Captured browser PATCH requests contained only the three editable fields. Browser HTTP responses used synthetic fixtures; live PowerSync was tested separately with the companion Flutter changes.

Please check that the PR fulfills these requirements

  • Tests for the changes have been added.

@matt8s

matt8s commented Nov 5, 2026

Copy link
Copy Markdown
Author

Added 5916aee to preserve the intended occurrence of a repeated hour when selecting a date. The calendar regression reproduced a one-hour shift for the second occurrence; the picker now prefers the previous UTC offset when it remains valid. Tests cover both occurrences and a next-day selection, retaining seconds and milliseconds.

All 125 nutrition tests and TypeScript checks passed. Lint reports only the two existing unrelated warnings. A live keyboard-driven browser/mobile check also passed: moving an entry across local midnight updated both day totals and mobile grouping, and a subsequent mobile edit appeared after explicit browser refresh.

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.

1 participant