-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mealSortOrder configuration not being respected. #66
Comments
Let me know if there is any additional info I can supply. Happy to help debug/troubleshoot whatever way I can. EDIT: The following query returns only dinner entries. I'm going to see if I can modify the code locally. I'll keep you posted.
Returned JSON:
|
That's awesome. It's always nice to see someone dig in and figure things out! |
No worries! Hope you're feeling better, or start to soon! |
So there are 2 ways to go about this. Fix the filter in // Filter meal types not in mealSortOrder.
meals.filter((meal) => mealSortOrder.includes(meal.entryType)); Actually save the results of the filter into the // Filter meal types not in mealSortOrder.
meals = meals.filter((meal) => mealSortOrder.includes(meal.entryType)); Or alter However, I would keep using if (payload.mealSortOrder && payload.mealSortOrder.length > 0) {
const mealSortOrder = payload.mealSortOrder.join('", "');
const entryType = `entryType in ["${mealSortOrder}"]`;
params.append("queryFilter", entryType);
} I think using the second method to fix this is best, since it limits the response from the API and the filtering would not longer be needed. |
Thanks @zanix. I only created a new variable in case I was missing the whole point of the mealSortOrder variable, and didn't want to break it for someone if I had made a pull request and was just using that config wrong. Edit: Nevermind you're already aware ;) |
## [1.6.1](v1.6.0...v1.6.1) (2024-09-03) ### Bug Fixes * mealSortOrder actually filters entry types ([62a247b](62a247b)), closes [#66](#66)
🎉 This issue has been resolved in version 1.6.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Your device: Ryzen 7 1700x, 48GB Ram
OS & Version: Unraid Server 6.12.10,
Node, NPM version: node 20.16.0, npm 10.8.1
MagicMirror version: 2.28.0
How you are running MagicMirror: Docker, serveronly mode
Browser: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0"
Describe the bug: Configured to only show dinner items, but is showing Lunch and Dinner
To Reproduce: Configure module with mealSortOrder: ["dinner"], module pulls lunch and dinner and breakfast
Expected behavior: Only the selected meal category should be pulled or displayed
Screenshots:
![Screenshot 2024-08-18 164506](https://private-user-images.githubusercontent.com/1055037/358937741-34d36ad5-892a-49cb-aca3-941a4fd221c5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MzQyNjQsIm5iZiI6MTczODgzMzk2NCwicGF0aCI6Ii8xMDU1MDM3LzM1ODkzNzc0MS0zNGQzNmFkNS04OTJhLTQ5Y2ItYWNhMy05NDFhNGZkMjIxYzUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDZUMDkyNjA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjRhOTYzY2U2ZjA0YWQ4NjU2NzM4MjI3MjJhY2U1Y2I5YjRlMTkzOTE4MDJkYjExOTBjN2YwNDc4ZmI5Y2RkYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.6vihF4xYQPA6te5D0J7S7EqFMa71MID4tZCpjPge_ek)
![Screenshot 2024-08-18 164528](https://private-user-images.githubusercontent.com/1055037/358937742-61af9e3c-b2d4-419e-9564-3cf17a97801a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MzQyNjQsIm5iZiI6MTczODgzMzk2NCwicGF0aCI6Ii8xMDU1MDM3LzM1ODkzNzc0Mi02MWFmOWUzYy1iMmQ0LTQxOWUtOTU2NC0zY2YxN2E5NzgwMWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDZUMDkyNjA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZTYzMGZiYTgwZDMxNzZjZGUwOTk1MWVmNzVkZDJkZDEwYjBlMWNkZTM5YjkyMTcxZWUyMTYyMzI4NWMyYmIyOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.sAIbhbOF6B2uBtG-CerpS0hvgLMGY1G_B7tOckWfON0)
Additional context: Log here:
[2024-08-18 16:42:35.648] [DEBUG] [MMM-MealieMenu] Meals: [{"date":"2024-08-18","entryType":"dinner","title":"","text":"","recipeId":"1559708c-f947-466b-8efa-4de7e85a54b7","id":79,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":{"id":"1559708c-f947-466b-8efa-4de7e85a54b7","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"Sheet Pan Parmesan Steak and Potatoes","slug":"sheet-pan-parmesan-steak-and-potatoes","image":"3fu4","recipeYield":"5 servings","totalTime":"45 Minutes","prepTime":"15 Minutes","cookTime":null,"performTime":"30 Minutes","description":"","recipeCategory":[{"id":"9b778ba1-c0dd-4aa8-a840-a593f3925964","name":"Dinner - Weekend","slug":"dinner-weekend"},{"id":"ae733450-4a64-4717-8e48-699b29d871fc","name":"Dinner - Weeknight","slug":"dinner-weeknight"}],"tags":[{"id":"d3d904b6-1ddf-4f78-843a-7977c7cd4b82","name":"Flank Steak","slug":"flank-steak"}],"tools":[],"rating":5,"orgURL":"https://therealfooddietitians.com/sheet-pan-parmesan-steak-and-potatoes/?utm_source=rss&utm_medium=rss&utm_campaign=sheet-pan-parmesan-steak-and-potatoes","dateAdded":"2024-07-07","dateUpdated":"2024-08-13T03:51:25.341938","createdAt":"2024-07-07T17:34:45.407639","updateAt":"2024-08-13T03:51:25.344460","lastMade":"2024-07-16T04:59:59"}},{"date":"2024-08-18","entryType":"lunch","title":"","text":"","recipeId":"f15a3987-1ccc-4f86-b97f-0ca5c3e9e8ba","id":82,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":{"id":"f15a3987-1ccc-4f86-b97f-0ca5c3e9e8ba","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"Homemade Pizza Lunchables","slug":"homemade-pizza-lunchables","image":"4IIb","recipeYield":"4 servings","totalTime":"10 Minutes","prepTime":"10 Minutes","cookTime":null,"performTime":null,"description":"","recipeCategory":[{"id":"cc57aa01-dd71-430f-819a-8df2b9561aa0","name":"Lunch","slug":"lunch"}],"tags":[],"tools":[],"rating":null,"orgURL":"https://momtomomnutrition.com/food-and-recipes/homemade-pizza-lunchables/","dateAdded":"2024-07-07","dateUpdated":"2024-08-13T03:51:25.588188","createdAt":"2024-07-07T17:16:31.188658","updateAt":"2024-08-13T03:51:25.590166","lastMade":null}},{"date":"2024-08-18","entryType":"breakfast","title":"","text":"","recipeId":"f389f0b5-c9ed-42fd-8369-f3d059dab8de","id":88,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"dfb6f23d-df99-49ee-a18a-d2816099e9a9","recipe":{"id":"f389f0b5-c9ed-42fd-8369-f3d059dab8de","userId":"dfb6f23d-df99-49ee-a18a-d2816099e9a9","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"Apple Cider Chicken","slug":"apple-cider-chicken","image":"no image","recipeYield":"4 serving(s)","totalTime":null,"prepTime":null,"cookTime":null,"performTime":null,"description":"","recipeCategory":[{"id":"9b778ba1-c0dd-4aa8-a840-a593f3925964","name":"Dinner - Weekend","slug":"dinner-weekend"},{"id":"ae733450-4a64-4717-8e48-699b29d871fc","name":"Dinner - Weeknight","slug":"dinner-weeknight"},{"id":"07d8eae2-e7aa-4653-a25a-8bd88d30e16b","name":"Winter","slug":"winter"}],"tags":[],"tools":[],"rating":null,"orgURL":"https://www.foodnetwork.com/recipes/sunny-anderson/apple-cider-chicken-recipe-1952273","dateAdded":"2021-10-24","dateUpdated":"2024-08-13T03:51:41.928831","createdAt":"2022-12-23T21:25:04.708767","updateAt":"2024-08-13T03:51:41.930788","lastMade":null}},{"date":"2024-08-19","entryType":"dinner","title":"","text":"","recipeId":"d4cc4b92-95e9-4d70-afd2-7fcefdce48ea","id":77,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":{"id":"d4cc4b92-95e9-4d70-afd2-7fcefdce48ea","userId":"dfb6f23d-df99-49ee-a18a-d2816099e9a9","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"Fried Rice","slug":"fried-rice","image":"no image","recipeYield":"4 serving(s)","totalTime":null,"prepTime":null,"cookTime":null,"performTime":null,"description":"Fried Rice from Delish.com is the best thing to make with your leftover rice.","recipeCategory":[{"id":"9b778ba1-c0dd-4aa8-a840-a593f3925964","name":"Dinner - Weekend","slug":"dinner-weekend"},{"id":"ae733450-4a64-4717-8e48-699b29d871fc","name":"Dinner - Weeknight","slug":"dinner-weeknight"},{"id":"5ed29a3c-2ce0-4be0-9749-9805934051bb","name":"Summer","slug":"summer"},{"id":"07d8eae2-e7aa-4653-a25a-8bd88d30e16b","name":"Winter","slug":"winter"}],"tags":[],"tools":[],"rating":null,"orgURL":"https://www.delish.com/cooking/recipe-ideas/a25325036/how-to-make-fried-rice/","dateAdded":"2021-10-18","dateUpdated":"2024-08-13T03:51:35.916166","createdAt":"2022-12-23T21:25:07.748630","updateAt":"2024-08-13T03:51:35.918287","lastMade":null}},{"date":"2024-08-19","entryType":"lunch","title":"[Hot] Chicken Nuggets","text":"","recipeId":null,"id":83,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":null},{"date":"2024-08-20","entryType":"dinner","title":"Culver's","text":"","recipeId":null,"id":74,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":null},{"date":"2024-08-20","entryType":"lunch","title":"[Hot] Hot Dogs and Chili","text":"","recipeId":null,"id":84,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":null},{"date":"2024-08-21","entryType":"dinner","title":"","text":"","recipeId":"593e7ae4-7f67-4d5c-ba73-0bcb60ffd2e5","id":76,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":{"id":"593e7ae4-7f67-4d5c-ba73-0bcb60ffd2e5","userId":"dfb6f23d-df99-49ee-a18a-d2816099e9a9","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"The Perfect Grilled Cheese","slug":"the-perfect-grilled-cheese","image":"no image","recipeYield":"1 serving(s)","totalTime":null,"prepTime":null,"cookTime":null,"performTime":null,"description":"The classic and simple grilled cheese sandwich can be reimagined multiple ways just by changing up the bread and cheese.","recipeCategory":[{"id":"9b778ba1-c0dd-4aa8-a840-a593f3925964","name":"Dinner - Weekend","slug":"dinner-weekend"},{"id":"ae733450-4a64-4717-8e48-699b29d871fc","name":"Dinner - Weeknight","slug":"dinner-weeknight"},{"id":"5ed29a3c-2ce0-4be0-9749-9805934051bb","name":"Summer","slug":"summer"},{"id":"07d8eae2-e7aa-4653-a25a-8bd88d30e16b","name":"Winter","slug":"winter"},{"id":"cc57aa01-dd71-430f-819a-8df2b9561aa0","name":"Lunch","slug":"lunch"}],"tags":[],"tools":[],"rating":null,"orgURL":"https://www.foodnetwork.com/recipes/food-network-kitchen/the-perfect-grilled-cheese-3636831","dateAdded":"2021-10-18","dateUpdated":"2024-08-13T03:51:29.622768","createdAt":"2022-12-23T21:25:11.461749","updateAt":"2024-08-13T03:51:29.625051","lastMade":null}},{"date":"2024-08-21","entryType":"lunch","title":"","text":"","recipeId":"d4cc4b92-95e9-4d70-afd2-7fcefdce48ea","id":81,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":{"id":"d4cc4b92-95e9-4d70-afd2-7fcefdce48ea","userId":"dfb6f23d-df99-49ee-a18a-d2816099e9a9","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"Fried Rice","slug":"fried-rice","image":"no image","recipeYield":"4 serving(s)","totalTime":null,"prepTime":null,"cookTime":null,"performTime":null,"description":"Fried Rice from Delish.com is the best thing to make with your leftover rice.","recipeCategory":[{"id":"9b778ba1-c0dd-4aa8-a840-a593f3925964","name":"Dinner - Weekend","slug":"dinner-weekend"},{"id":"ae733450-4a64-4717-8e48-699b29d871fc","name":"Dinner - Weeknight","slug":"dinner-weeknight"},{"id":"5ed29a3c-2ce0-4be0-9749-9805934051bb","name":"Summer","slug":"summer"},{"id":"07d8eae2-e7aa-4653-a25a-8bd88d30e16b","name":"Winter","slug":"winter"}],"tags":[],"tools":[],"rating":null,"orgURL":"https://www.delish.com/cooking/recipe-ideas/a25325036/how-to-make-fried-rice/","dateAdded":"2021-10-18","dateUpdated":"2024-08-13T03:51:35.916166","createdAt":"2022-12-23T21:25:07.748630","updateAt":"2024-08-13T03:51:35.918287","lastMade":null}},{"date":"2024-08-22","entryType":"dinner","title":"Mom & Dads","text":"","recipeId":null,"id":75,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":null},{"date":"2024-08-22","entryType":"lunch","title":"[Hot] Pizza","text":"","recipeId":null,"id":85,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":null},{"date":"2024-08-23","entryType":"dinner","title":"","text":"","recipeId":"f26f5e45-f427-44df-b094-6b21bcf132f3","id":78,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":{"id":"f26f5e45-f427-44df-b094-6b21bcf132f3","userId":"dfb6f23d-df99-49ee-a18a-d2816099e9a9","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"Cajun Sausage","slug":"cajun-sausage","image":"45","recipeYield":"","totalTime":"10mins","prepTime":"5mins","cookTime":null,"performTime":"3mins","description":"Cajun kielbasa, potatoes and green beans. \nThis is delicious and fast! It can easily be doubled for a crowd. ","recipeCategory":[{"id":"9b778ba1-c0dd-4aa8-a840-a593f3925964","name":"Dinner - Weekend","slug":"dinner-weekend"},{"id":"ae733450-4a64-4717-8e48-699b29d871fc","name":"Dinner - Weeknight","slug":"dinner-weeknight"},{"id":"5ed29a3c-2ce0-4be0-9749-9805934051bb","name":"Summer","slug":"summer"},{"id":"07d8eae2-e7aa-4653-a25a-8bd88d30e16b","name":"Winter","slug":"winter"}],"tags":[],"tools":[],"rating":null,"orgURL":null,"dateAdded":"2021-10-14","dateUpdated":"2024-08-13T03:51:40.034164","createdAt":"2022-12-23T21:25:05.728748","updateAt":"2024-08-13T03:51:40.036274","lastMade":null}},{"date":"2024-08-23","entryType":"lunch","title":"","text":"","recipeId":"7a80e404-4798-4376-8b96-fe353016016f","id":80,"groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","recipe":{"id":"7a80e404-4798-4376-8b96-fe353016016f","userId":"51736457-69e0-4204-ac6e-e84d8f3d1c21","groupId":"227a352d-5941-49fd-a8df-e60c90987cd9","name":"Fruity Peanut Butter Pitas","slug":"fruity-peanut-butter-pitas","image":"s5vd","recipeYield":"2 servings","totalTime":"5 Minutes","prepTime":"5 Minutes","cookTime":null,"performTime":"none","description":"My kids ask for these pita sandwiches all the time. They haven’t noticed that as good as the pitas taste, they’re good for them too.—Kim Holmes, Emerald Park, Saskatchewan","recipeCategory":[{"id":"cc57aa01-dd71-430f-819a-8df2b9561aa0","name":"Lunch","slug":"lunch"}],"tags":[],"tools":[],"rating":5,"orgURL":"https://www.tasteofhome.com/recipes/fruity-peanut-butter-pitas/","dateAdded":"2024-07-14","dateUpdated":"2024-08-13T03:51:24.850941","createdAt":"2024-07-14T12:45:53.516219","updateAt":"2024-08-13T03:51:24.853118","lastMade":null}}]
The text was updated successfully, but these errors were encountered: