fix: list every meal that a shopping trip buys for in the PDF - #70
Merged
Merged
Conversation
The planner puts an item that keeps on an earlier trip, also for a later week (ADR 0014, 0015). The week of a trip therefore does not say which meals its items feed, and callers had no way to know it. TripItem.cookDays now holds the day of every cooking event that the item buys for. The next commits use it to justify each trip in the shopping PDF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A shopping trip buys cook days, not weeks, so a meal can only be matched to its trip by the day of its cook event. _fedSubMeals already tracked that day and dropped it. IngredientMealRequirement now stores cookDayIndex. cookWeekIndex stays as a getter derived from it, so the week is not stored twice. The model is never saved to a file, so the renamed JSON key breaks no user data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shopping PDF assumed that a trip buys only the weeks up to the next trip. The planner puts an item that keeps on an earlier trip, also for later weeks, so the PDF dropped those meals. With the bundled defaults, trip 1 bought 28 eggs but listed only the 8 eggs of week 1, and the meals of weeks 2 and 3 appeared on no page. Each meal, and each cooking event that ranks the products of a trip, now goes under the trip whose items hold its cook day. A meal that the owned stock covers goes under the first trip that buys the ingredient, because the list shows the whole need. ADR 0014 now states the day rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guplem
enabled auto-merge
September 24, 2026 11:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shopping PDF dropped meals from the "Needed for" list of items that keep long. With the bundled defaults, trip 1 bought 28 eggs but listed only the 8 eggs of week 1. The meals of weeks 2 and 3 appeared on no page.
Cause
The PDF assumed that a trip buys only the weeks up to the next trip (
_weeksByTrip). The planner puts an item that keeps on an earlier trip, also for later weeks (ADR 0014, 0015). So the trip that bought the item listed only its own week, and the later trips did not buy it at all. The same rule also chose the "Recommended" product from the wrong cooking events.Fix
TripItem.cookDays: the planner records the cook days that each trip item buys.IngredientMealRequirement.cookDayIndexreplaces the storedcookWeekIndex, which is now a getter. The model is never saved to a file.buildShoppingPdfDocumentputs each meal and each ranking event under the trip whose items hold its cook day. A meal that the owned stock covers goes under the first trip that buys the ingredient, because the list shows the whole need.Result on the bundled defaults (trip 1)
Tests
flutter analyzeis clean, and the format check passes.🤖 Generated with Claude Code