🐛 fix: sort homepage meal plan entries by meal type start time - #4670
Open
MichaelvanLaar wants to merge 2 commits into
Open
🐛 fix: sort homepage meal plan entries by meal type start time#4670MichaelvanLaar wants to merge 2 commits into
MichaelvanLaar wants to merge 2 commits into
Conversation
The homepage meal planner window was displaying meals in creation order (insertion order of the store's Map) instead of by the meal type starting time configured in settings, unlike the calendar view which sorts implicitly via vue-simple-calendar's startDate ordering. Adds a sort on mealType.time (primary) and mealType.order (secondary) to the plan_entries filter in HorizontalMealPlanWindow.vue. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes the home page meal planner widget ordering so that meal plan entries display in configured meal-type start-time order (instead of insertion/creation order), aligning the widget with the calendar view behavior.
Changes:
- Sorts
meal_plan_gridentries bymealType.time(primary) andmealType.order(secondary), with missing times placed last. - Applies consistent formatting updates in
HorizontalMealPlanWindow.vue(template/script/style).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+123
to
+125
| const timeA = a.mealType?.time ?? "" | ||
| const timeB = b.mealType?.time ?? "" | ||
| if (timeA !== timeB) return timeA < timeB ? -1 : 1 |
Author
There was a problem hiding this comment.
Implemented the fix suggested by Copilot: replaced the U+FFFF sentinel with explicit null-checks so entries without a mealType.time always sort to the end. See commit 2d73aca.
…n sort
Replace the U+FFFF sentinel character ("ï¿¿") used as a fallback for
missing mealType.time with explicit null-checks. Entries without a time
sort to the end; entries with a time sort lexicographically (correct for
"HH:MM:SS" fixed-format strings).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The meal planner widget on the home page was displaying meals in creation order (the insertion order of the internal store map), rather than by the meal type starting time configured in Settings → Meal Plan.
The calendar view already shows meals in the correct order because
vue-simple-calendarsorts calendar items bystartDate, and the backend serializer (_apply_default_time) bakesmealType.timeintofromDateat save time. The home page widget had no equivalent sorting.Changes
vue3/src/components/display/HorizontalMealPlanWindow.vueAdded a
.sort()after the.filter()in themeal_plan_gridcomputed property. Entries are sorted by:mealType.time(primary) — the starting time set in meal plan settings, stored as"HH:MM:SS"and sortable lexicographicallymealType.order(secondary) — tiebreaker for meal types sharing the same time or without a time configuredMeal types with no time configured sort last.
How to test