diff --git a/MoneyMap/Pages/Receipts.cshtml.cs b/MoneyMap/Pages/Receipts.cshtml.cs index 0e6043d..f39f76f 100644 --- a/MoneyMap/Pages/Receipts.cshtml.cs +++ b/MoneyMap/Pages/Receipts.cshtml.cs @@ -250,11 +250,8 @@ namespace MoneyMap.Pages query = query.Where(t => t.Date >= minDate && t.Date <= maxDate); } - // Get all candidates within date range (don't filter by merchant in query) + // Get all candidates within date range (don't limit yet - we need all matches) var candidates = await query - .OrderByDescending(t => t.Date) - .ThenByDescending(t => t.Id) - .Take(100) // Get more candidates for sorting .ToListAsync(); // If receipt has merchant, sort matches by relevance (but don't exclude) @@ -285,13 +282,16 @@ namespace MoneyMap.Pages return 0; }) .ThenByDescending(t => t.Date) - .Take(50) + .ThenByDescending(t => t.Id) .ToList(); } else { - // No merchant filter, just take top 50 by date - candidates = candidates.Take(50).ToList(); + // No merchant filter, just sort by date + candidates = candidates + .OrderByDescending(t => t.Date) + .ThenByDescending(t => t.Id) + .ToList(); } // Calculate match scores and mark close amount matches