You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shopping list: removing a recipe unticks items shown under an aisle name #654
Removing a recipe from the shopping list unticks an item that is still on the list. The answer to the page's next POST /api/shopping_list already lacks it in checked: the tick is gone from .shopping-checked, not just from the page.
Steps to reproduce
With the seed (config/aisle.conf has egg | eggs):
Add Easy Pancakes and Mexican Style Burrito to the shopping list. Both use @eggs; the list shows it as egg.
Tick egg.
Remove Easy Pancakes.
egg is unticked, though the burrito still needs eggs.
With curl: checked is ["egg","butter"] before the remove, ["butter"] after. butter is written the same way in both recipes and keeps its tick.
Cause
Since 7700032 (#318), remove_from_shopping_list (and POST /api/shopping_list/compact) drops the ticks of ingredients no longer on the list, through store.compact(aggregate_current_ingredient_names(..)).
aggregate_current_ingredient_names returns the names as the recipes write them (eggs; its doc comment says so). But POST /api/shopping_list runs the list through use_common_names(&aisle, ..), so the page shows, and ticks, the aisle file's first name (egg). The case-insensitive compare finds no egg among the remaining ingredients and drops it.
Any ingredient whose recipe name is a synonym in aisle.conf is affected (eggs, sea salt, extra virgin olive oil… in the seed). Grouping entries on the aisles page (#631) makes such synonyms more common.
Fix
Compact against the names the page shows as well: the common names from the aisle file, plus the recipes' own names, so that a tick made under one of those still counts.
Activity