Skip to content

Include custom meals in Product/Food search results#304

Open
LarytheLord wants to merge 2 commits intosimonoppowa:developfrom
LarytheLord:fix/custom-meals-search-267
Open

Include custom meals in Product/Food search results#304
LarytheLord wants to merge 2 commits intosimonoppowa:developfrom
LarytheLord:fix/custom-meals-search-267

Conversation

@LarytheLord
Copy link
Copy Markdown

@LarytheLord LarytheLord commented Feb 27, 2026

Summary

Custom meals were only discoverable in the Recently added tab, because Product/Food search paths queried remote OFF/FDC sources only. This made reusing manually created meals hard, as reported in #267.

This PR includes matching custom meals from recent intake at the top of both Product and Food search results.

Changes

  • Extend SearchProductsUseCase to read recent intake via GetIntakeUsecase.
  • For non-empty search strings:
    • filter recent meals to MealSourceEntity.custom
    • match on name/brand case-insensitively
    • prepend matches before remote OFF/FDC results
    • deduplicate by source + code/name
  • Update DI wiring in locator.dart for the new use case dependency.
  • Add search_products_usecase_test.dart covering:
    • custom meal inclusion in OFF search
    • deduplication behavior
    • no local lookup for blank queries

Notes

I could not execute Flutter tests in this environment because flutter is not installed (command not found).

@LarytheLord
Copy link
Copy Markdown
Author

Pushed a follow-up technical pass in commit 40c5232 to strengthen coverage for this search behavior:\n\n- added a test that verifies custom meals can match by brand (case-insensitive), not only by name\n- added a test that verifies deduplication still works when custom meals have no code (fallback name-based key path)\n\nThis should make the custom-meal prepend logic safer against edge cases in real intake history.

@LarytheLord LarytheLord changed the base branch from main to develop March 8, 2026 14:42
@LarytheLord LarytheLord force-pushed the fix/custom-meals-search-267 branch from 40c5232 to c5fdae3 Compare March 12, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant