fixed shopping list meal plan logic
This commit is contained in:
@ -65,7 +65,13 @@ class RecipeShoppingEditor():
|
|||||||
try:
|
try:
|
||||||
self.servings = float(self._kwargs.get('servings', None))
|
self.servings = float(self._kwargs.get('servings', None))
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
self.servings = getattr(self._shopping_list_recipe, 'servings', None) or getattr(self.mealplan, 'servings', None) or getattr(self.recipe, 'servings', None)
|
self.servings = getattr(self.recipe, 'servings', None)
|
||||||
|
|
||||||
|
if hasattr(self,'mealplan') and getattr(self.mealplan, 'servings', None):
|
||||||
|
self.servings = getattr(self.mealplan, 'servings', None)
|
||||||
|
if hasattr(self, '_shopping_list_recipe') and getattr(self._shopping_list_recipe, 'servings', None):
|
||||||
|
self.servings = getattr(self._shopping_list_recipe, 'servings', None)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _recipe_servings(self):
|
def _recipe_servings(self):
|
||||||
@ -108,6 +114,7 @@ class RecipeShoppingEditor():
|
|||||||
if servings := kwargs.get('servings', None):
|
if servings := kwargs.get('servings', None):
|
||||||
self.servings = float(servings)
|
self.servings = float(servings)
|
||||||
|
|
||||||
|
self.mealplan = None
|
||||||
if mealplan := kwargs.get('mealplan', None): # it appears this code is never called just init is used, no time to validate
|
if mealplan := kwargs.get('mealplan', None): # it appears this code is never called just init is used, no time to validate
|
||||||
self.mealplan = MealPlan.objects.filter(id=mealplan['id'], space=self.space).fist()
|
self.mealplan = MealPlan.objects.filter(id=mealplan['id'], space=self.space).fist()
|
||||||
elif recipe := kwargs.get('recipe', None):
|
elif recipe := kwargs.get('recipe', None):
|
||||||
|
@ -100,7 +100,9 @@
|
|||||||
<span v-if="plan.note">
|
<span v-if="plan.note">
|
||||||
<small>{{ plan.note }}</small> <br/>
|
<small>{{ plan.note }}</small> <br/>
|
||||||
</span>
|
</span>
|
||||||
<small class="text-muted">{{ plan.meal_type_name }}
|
<small class="text-muted">
|
||||||
|
<span v-if="plan.shopping" class="font-light"><i class="fas fa-shopping-cart fa-xs "/></span>
|
||||||
|
{{ plan.meal_type_name }}
|
||||||
<span v-if="plan.recipe">
|
<span v-if="plan.recipe">
|
||||||
- <i class="fa fa-clock"></i> {{ plan.recipe.working_time + plan.recipe.waiting_time }} {{ $t('min') }}
|
- <i class="fa fa-clock"></i> {{ plan.recipe.working_time + plan.recipe.waiting_time }} {{ $t('min') }}
|
||||||
</span>
|
</span>
|
||||||
|
Reference in New Issue
Block a user