Fixed duplicate overlapping shops

This commit is contained in:
jableader 2024-10-14 16:01:47 +11:00
parent 9afe89b983
commit ff2d348ec9

View file

@ -263,6 +263,9 @@ async def get_current_shopping_list(conn: sqlite3.Connection = Depends(get_db))
if request.meal_id:
overlapping.extend([r async for r in shopping.get_shopping_list_with_meal(conn, request.meal_id)])
seen = set()
overlapping = [o for o in overlapping if o.id not in seen and not seen.add(o.id)]
return CurrentShoppingList(requests=current_requests, overlapping_previous_shops=overlapping)
@app.get("/api/shopping/{list_id}")