feat(planner): show score badges for all recipes in RecipePicker
- +server.ts: pass topN=100 so all recipes are scored in one request - RecipePicker: Empfohlen keeps top 5 with scoreDelta > 0; builds a scoreMap from all suggestions; shows green/yellow/red delta badge on every recipe in Alle Rezepte that has a score entry - Extracted scoreBadge snippet to avoid duplication between sections Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ export const GET: RequestHandler = async ({ fetch, url }) => {
|
||||
try {
|
||||
const api = apiClient(fetch);
|
||||
const { data } = await api.GET('/v1/week-plans/{id}/suggestions', {
|
||||
params: { path: { id: planId }, query: { slotDate: date } }
|
||||
params: { path: { id: planId }, query: { slotDate: date, topN: 100 } }
|
||||
});
|
||||
|
||||
const suggestions = (data?.suggestions ?? []).sort(
|
||||
|
||||
@@ -51,7 +51,7 @@ describe('GET /planner — suggestions route handler', () => {
|
||||
const body = await response.json();
|
||||
|
||||
expect(mockGet).toHaveBeenCalledWith('/v1/week-plans/{id}/suggestions', expect.objectContaining({
|
||||
params: { path: { id: PLAN_UUID }, query: { slotDate: DATE } }
|
||||
params: { path: { id: PLAN_UUID }, query: { slotDate: DATE, topN: 100 } }
|
||||
}));
|
||||
expect(body.suggestions).toHaveLength(2);
|
||||
// sorted by scoreDelta desc: 0.0 before -1.5
|
||||
|
||||
Reference in New Issue
Block a user