diff --git a/cookbook/tests/api/test_api_meal_plan.py b/cookbook/tests/api/test_api_meal_plan.py index b27f6a0b..2a8243e8 100644 --- a/cookbook/tests/api/test_api_meal_plan.py +++ b/cookbook/tests/api/test_api_meal_plan.py @@ -12,6 +12,7 @@ from cookbook.tests.factories import RecipeFactory LIST_URL = 'api:mealplan-list' DETAIL_URL = 'api:mealplan-detail' + # NOTE: auto adding shopping list from meal plan is tested in test_shopping_recipe as tests are identical @@ -22,13 +23,13 @@ def meal_type(space_1, u1_s1): @pytest.fixture() def obj_1(space_1, recipe_1_s1, meal_type, u1_s1): - return MealPlan.objects.create(recipe=recipe_1_s1, space=space_1, meal_type=meal_type, date=datetime.now(), + return MealPlan.objects.create(recipe=recipe_1_s1, space=space_1, meal_type=meal_type, from_date=datetime.now(), to_date=datetime.now(), created_by=auth.get_user(u1_s1)) @pytest.fixture def obj_2(space_1, recipe_1_s1, meal_type, u1_s1): - return MealPlan.objects.create(recipe=recipe_1_s1, space=space_1, meal_type=meal_type, date=datetime.now(), + return MealPlan.objects.create(recipe=recipe_1_s1, space=space_1, meal_type=meal_type, from_date=datetime.now(), to_date=datetime.now(), created_by=auth.get_user(u1_s1)) @@ -109,7 +110,7 @@ def test_add(arg, request, u1_s2, recipe_1_s1, meal_type): r = c.post( reverse(LIST_URL), {'recipe': {'id': recipe_1_s1.id, 'name': recipe_1_s1.name, 'keywords': []}, 'meal_type': {'id': meal_type.id, 'name': meal_type.name}, - 'date': (datetime.now()).strftime("%Y-%m-%d"), 'servings': 1, 'title': 'test', 'shared': []}, + 'from_date': (datetime.now()).strftime("%Y-%m-%d"), 'to_date': (datetime.now()).strftime("%Y-%m-%d"), 'servings': 1, 'title': 'test', 'shared': []}, content_type='application/json' ) response = json.loads(r.content) @@ -151,7 +152,7 @@ def test_add_with_shopping(u1_s1, meal_type): r = u1_s1.post( reverse(LIST_URL), {'recipe': {'id': recipe.id, 'name': recipe.name, 'keywords': []}, 'meal_type': {'id': meal_type.id, 'name': meal_type.name}, - 'date': (datetime.now()).strftime("%Y-%m-%d"), 'servings': 1, 'title': 'test', 'shared': [], 'addshopping': True}, + 'from_date': (datetime.now()).strftime("%Y-%m-%d"), 'to_date': (datetime.now()).strftime("%Y-%m-%d"), 'servings': 1, 'title': 'test', 'shared': [], 'addshopping': True}, content_type='application/json' ) diff --git a/vue/src/apps/MealPlanView/MealPlanView.vue b/vue/src/apps/MealPlanView/MealPlanView.vue index 6c49a117..9f65a3ab 100644 --- a/vue/src/apps/MealPlanView/MealPlanView.vue +++ b/vue/src/apps/MealPlanView/MealPlanView.vue @@ -380,18 +380,14 @@ export default { } }, mounted() { - this.$nextTick(function () { - if (this.$cookies.isKey(SETTINGS_COOKIE_NAME)) { - this.settings = Object.assign({}, this.settings, this.$cookies.get(SETTINGS_COOKIE_NAME)) - } - }) + this.settings = useMealPlanStore().client_settings this.$i18n.locale = window.CUSTOM_LOCALE moment.locale(window.CUSTOM_LOCALE) }, watch: { settings: { handler() { - this.$cookies.set(SETTINGS_COOKIE_NAME, this.settings, "360d") + useMealPlanStore().updateClientSettings(this.settings) }, deep: true, }, diff --git a/vue/src/components/Settings/MealPlanSettingsComponent.vue b/vue/src/components/Settings/MealPlanSettingsComponent.vue index 672f2bf6..34cad698 100644 --- a/vue/src/components/Settings/MealPlanSettingsComponent.vue +++ b/vue/src/components/Settings/MealPlanSettingsComponent.vue @@ -14,24 +14,24 @@