feat: Listen-Dialog mit Mengen/Einheiten, Mitai ohne Kochrezepte
Roh-Kombinationen statt Rezept-Sprache; Zutaten suchen, EL/TL/Prise auf Gramm. Gekochte Gerichte und Ausbeute bleiben Tandoor. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a7e5511039
commit
fa542e0fb9
17 files changed
+776
-203
No files matched your search
@@ -3,11 +3,13 @@ from datetime import date
|
||||
from csv_parser.executor import guess_nutrition_item_fields
|
||||
from data_layer.food_mapping import (
|
||||
filter_unmapped_since,
|
||||
list_quantity_units,
|
||||
merge_unmapped_rows,
|
||||
normalize_food_name,
|
||||
parse_quantity,
|
||||
parse_quantity_g,
|
||||
primary_search_query,
|
||||
resolve_quantity,
|
||||
)
|
||||
from data_layer.nutrition_items import macros_differ
|
||||
|
||||
@@ -46,6 +48,20 @@ def test_parse_quantity_g():
|
||||
assert parse_quantity("2 EL")["unit"] == "el"
|
||||
|
||||
|
||||
def test_resolve_quantity_household_units():
|
||||
two_tl = resolve_quantity(quantity_amount=2, source_unit="tl")
|
||||
assert two_tl["quantity_g"] == 10.0
|
||||
assert two_tl["quantity_raw"] == "2 TL"
|
||||
pinch = resolve_quantity(quantity_amount=1, source_unit="prise")
|
||||
assert pinch["quantity_g"] == 0.3
|
||||
slice_ = resolve_quantity(quantity_amount=1, source_unit="stück")
|
||||
assert slice_["quantity_g"] is None
|
||||
assert slice_["needs_unit_map"] is True
|
||||
assert resolve_quantity(quantity_amount=1, source_unit="stück", grams_per_unit=60)["quantity_g"] == 60.0
|
||||
ids = [u["id"] for u in list_quantity_units()]
|
||||
assert "tl" in ids and "prise" in ids
|
||||
|
||||
|
||||
def test_guess_fddb_bezeichnung_without_template_mapping():
|
||||
name, qty = guess_nutrition_item_fields({
|
||||
"bezeichnung": "50 g Hähnchen",
|
||||
|
||||
Reference in new issue
Block a user