Интегрирован wesp в сайт
CI / quality (push) Canceled after 0s

This commit is contained in:
влад
2026-07-17 12:57:18 +03:00
parent 5dfa06ddbe
commit 355c0ef9f1
883 changed files with 194576 additions and 177 deletions
@@ -0,0 +1,38 @@
"""Суточные итоги на голову (parity Excel Рацион КРС)."""
from app.lab.calc.engine import calculate_ration
def test_daily_total_scales_by_heads():
lines = [
{
"daily_kg": 141,
"in_ration": True,
"in_compound": False,
"dry_matter": 880,
"nutrients": {},
}
]
herd = calculate_ration("BEEF", lines, {}, heads_per_trip=141)
per_head = calculate_ration("BEEF", [{**lines[0], "daily_kg": 1}], {}, heads_per_trip=1)
herd_dm = next(i["content"] for i in herd["indicators"] if i["label"] == "Сухое вещество")
head_dm = next(i["content"] for i in per_head["indicators"] if i["label"] == "Сухое вещество")
assert herd_dm == head_dm == 880
def test_sv_from_nutrients_overrides_legacy_percent():
result = calculate_ration(
"BEEF",
[
{
"daily_kg": 10,
"in_ration": True,
"in_compound": False,
"dry_matter": 56,
"nutrients": {"СВ": 880},
}
],
{},
)
dm = next(i["content"] for i in result["indicators"] if i["label"] == "Сухое вещество")
assert dm == 8800