mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-09 17:33:12 -05:00
feat: sort by labels in shopping list copy if labels toggled (#3226)
* feat: sort by labels in shopping list copy if labels toggled * fix: call parent validator in shopping list item out (#3227) * fix: add a unit test for (#3227) * fixed messy post_validate logic * feat: label headings in shopping list copy * feat: blank line for each group in shopping list copy --------- Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
@@ -184,13 +184,13 @@ class Recipe(RecipeSummary):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@model_validator(mode="after")
|
||||
def post_validate(self):
|
||||
# the ingredient disable_amount property is unreliable,
|
||||
# so we set it here and recalculate the display property
|
||||
def calculate_missing_food_flags_and_format_display(self):
|
||||
disable_amount = self.settings.disable_amount if self.settings else True
|
||||
for ingredient in self.recipe_ingredient:
|
||||
ingredient.disable_amount = disable_amount
|
||||
ingredient.is_food = not ingredient.disable_amount
|
||||
|
||||
# recalculate the display property, since it depends on the disable_amount flag
|
||||
ingredient.display = ingredient._format_display()
|
||||
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user